Commit 253ca20f authored by 耨义强's avatar 耨义强

Merge branch 'zhengping' of http://tyw-server.synology.me:12345/shihao/rt_rmr42e into nou

parents 1ebd3cc5 e4dd577a
......@@ -7,7 +7,7 @@
<Targets>
<Target>
<TargetName>HaoJin232</TargetName>
<TargetName>RMR42E</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCC</pCCUsed>
......@@ -49,7 +49,7 @@
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\Objects\</OutputDirectory>
<OutputName>HaoJin</OutputName>
<OutputName>RMR42E</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
......@@ -383,16 +383,6 @@
<Group>
<GroupName>Application</GroupName>
<Files>
<File>
<FileName>Data_Fuel.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Application\Fuel\Data_Fuel.c</FilePath>
</File>
<File>
<FileName>Data_Fuel.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Application\Fuel\Data_Fuel.h</FilePath>
</File>
<File>
<FileName>BackLight.c</FileName>
<FileType>1</FileType>
......@@ -618,26 +608,6 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Analog\Analog_Signals.h</FilePath>
</File>
<File>
<FileName>Light_Sensor.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Light_Sensor\Light_Sensor.h</FilePath>
</File>
<File>
<FileName>Light_Sensor_Interface.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\Light_Sensor\Light_Sensor_Interface.c</FilePath>
</File>
<File>
<FileName>Light_Sensor_Interface.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\Light_Sensor\Light_Sensor_Interface.h</FilePath>
</File>
<File>
<FileName>Light_Sensor_V1.0.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Light_Sensor\Light_Sensor_V1.0.lib</FilePath>
</File>
<File>
<FileName>CAN_Lib.h</FileName>
<FileType>5</FileType>
......@@ -678,26 +648,6 @@
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Line_In\Line_In.lib</FilePath>
</File>
<File>
<FileName>System_Monitor.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor.h</FilePath>
</File>
<File>
<FileName>System_Monitor_User.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor_User.c</FilePath>
</File>
<File>
<FileName>System_Monitor_User.h</FileName>
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor_User.h</FilePath>
</File>
<File>
<FileName>eepromManage_20240305.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Eeprom\eepromManage_20240305.lib</FilePath>
</File>
<File>
<FileName>CAN_Signal.lib</FileName>
<FileType>4</FileType>
......@@ -713,11 +663,6 @@
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Mileage\libMileage_BAT32_V1.07.lib</FilePath>
</File>
<File>
<FileName>System_Monitor.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor.lib</FilePath>
</File>
<File>
<FileName>PowerManagement.lib</FileName>
<FileType>4</FileType>
......@@ -728,6 +673,21 @@
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\LED_Driver\LED_Driver_V1.3.lib</FilePath>
</File>
<File>
<FileName>System_Monitor.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor.c</FilePath>
</File>
<File>
<FileName>System_Monitor_User.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor_User.c</FilePath>
</File>
<File>
<FileName>eepromManage_20240305.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Eeprom\eepromManage_20240305.lib</FilePath>
</File>
</Files>
</Group>
<Group>
......@@ -1096,19 +1056,19 @@
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.5.0" condition="ARMv6_7_8-M Device">
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.8.0"/>
<targetInfos>
<targetInfo name="HaoJin232"/>
<targetInfo name="RMR42E"/>
</targetInfos>
</component>
<component Cclass="Device" Cgroup="ISR" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE">
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos>
<targetInfo name="HaoJin232"/>
<targetInfo name="RMR42E"/>
</targetInfos>
</component>
<component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE">
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos>
<targetInfo name="HaoJin232"/>
<targetInfo name="RMR42E"/>
</targetInfos>
</component>
</components>
......@@ -1118,7 +1078,7 @@
<component Cclass="Device" Cgroup="ISR" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/>
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos>
<targetInfo name="HaoJin232"/>
<targetInfo name="RMR42E"/>
</targetInfos>
</file>
<file attr="config" category="source" condition="Startup ARM" name="Device\Source\ARM\startup_BAT32A239.s" version="1.0.0">
......@@ -1126,7 +1086,7 @@
<component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/>
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos>
<targetInfo name="HaoJin232"/>
<targetInfo name="RMR42E"/>
</targetInfos>
</file>
<file attr="config" category="source" name="Device\Source\system_BAT32A239.c" version="1.0.0">
......@@ -1134,7 +1094,7 @@
<component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/>
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos>
<targetInfo name="HaoJin232"/>
<targetInfo name="RMR42E"/>
</targetInfos>
</file>
<file attr="config" category="header" name="Device\Source\userdefine.h" version="1.0.0">
......@@ -1142,7 +1102,7 @@
<component Cclass="Device" Cgroup="Startup" Cvendor="Cmsemicon" Cversion="1.0.0" condition="BAT32A239 CMSIS-CORE"/>
<package name="BAT32A239" schemaVersion="1.4" url="http://www.mcu.com.cn/pack/" vendor="Cmsemicon" version="1.0.5"/>
<targetInfos>
<targetInfo name="HaoJin232"/>
<targetInfo name="RMR42E"/>
</targetInfos>
</file>
<file attr="config" category="source" name="Device\Source\isr_BAT32A239.c" version="1.0.0">
......
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'RMR42E'
* Target: 'RMR42E'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "BAT32A239.h"
#endif /* RTE_COMPONENTS_H */
#ifndef APPLICATION_H__
#define APPLICATION_H__
#include "Fuel\Data_Fuel.h"
#include "GPIO_USER\GpioUser.h"
#include "BackLight\BackLight.h"
//#include "Data_VSpeed\Data_VSpeed.h"
//#include "Data_ESpeed\Data_ESpeed.h"
#include "CommonInterface\CommonInterface.h"
#include "SEG_DISPLAY\SEG_DISPLAY.h"
#include "SEG_DISPLAY\SEG_Ref.h"
......
......@@ -6,51 +6,15 @@
#define BACK_LIGHT_DAY 50
#define BACK_LIGHT_NIGHT 200
_Light g_Light;
_Light interact_Light;
uint8_t interact_PWM_Low_Duty = 0;
void BackLight_Init(void)
{
g_Light.Light_Day = 0XFFFF;
g_Light.Light_Night = 0XFFFF;
interact_Light.Light_Day = 0XFFFF;
interact_Light.Light_Night = 0XFFFF;
}
void BackLight_Process(void)
{
if (SYS_OPR_STAT_IGN_ON)
{
if(ALS_Get_Data1() > 200)//data1 500以内,data0 3000以内
{
if (g_Light.Light_Day < 15)//1.5s 1500ms
{
g_Light.Light_Day++;//100ms
}
else
{
g_Light.Light_Night = 0;
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_DAY);
}
}
else
{
if (g_Light.Light_Night < 15)
{
g_Light.Light_Night++;
}
else
{
g_Light.Light_Day = 0;
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_NIGHT);
}
}
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_DAY);
}
else
{
g_Light.Light_Day = 0;
g_Light.Light_Night = 0;
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 0);
}
}
......@@ -59,35 +23,10 @@ void Interact_Light_Process(void)
{
if (SYS_OPR_STAT_IGN_ON)
{
if(ALS_Get_Data1() > 200)//data1 500以内,data0 3000以内
{
if (interact_Light.Light_Day < 15)//1.5s 1500ms
{
interact_Light.Light_Day++;//100ms
}
else
{
interact_Light.Light_Night = 0;
TimerM_PWM_set_duty(TIMERM_COUNTER0, TIMERM_CHD, interact_PWM_Low_Duty * 10);
}
}
else
{
if (interact_Light.Light_Night < 15)
{
interact_Light.Light_Night++;
}
else
{
interact_Light.Light_Day = 0;
TimerM_PWM_set_duty(TIMERM_COUNTER0, TIMERM_CHD, BACK_LIGHT_NIGHT);
}
}
TimerM_PWM_set_duty(TIMERM_COUNTER0, TIMERM_CHD, interact_PWM_Low_Duty * 10);
}
else
{
interact_Light.Light_Day = 0;
interact_Light.Light_Night = 0;
TimerM_PWM_set_duty(TIMERM_COUNTER0, TIMERM_CHD, 0);
}
}
......@@ -2,17 +2,7 @@
#define _BACKLIGHT_H_
#include "common.h"
typedef struct
{
uint8_t Duty;
uint8_t Cycle;
uint16_t Light_Night;
uint16_t Light_Day;
} _Light;
extern _Light g_Light;
extern uint8_t interact_PWM_Low_Duty;
void BackLight_Init(void);
void BackLight_Process(void);
void Interact_Light_Process(void);
......
#include "Data_Fuel.h"
#include "Application.h"
#define FUEL_DATA_TIME 25u /*这里填写多长时间采集一个数据,单位ms*/
#define FUEL_DATA_NUM 20u /*燃油电阻采集数据总数 最大255*/
#define FUEL_CAL_START 5u /*数据排序后取中间部分计算平均:起始*/
#define FUEL_CAL_END 15u /*数据排序后取中间部分计算平均:结束*/
#define RETURN_DIFFERENCE 25u /*判断上升或下降的回差,精度0.1*/
#define FUEL_SEG_UP 0u
#define FUEL_SEG_DOWN 1u
uint16_t FuelData[FUEL_DATA_NUM];
uint8_t FuelDataCount = 0u;
uint16_t FuelR = 0u; /*滤波后的燃油电阻,精度0.1*/
static uint16_t FuelRBak = 0;
uint8_t DesFuelSetp = 0u;
uint8_t CurFuelSetp = 0u;
uint8_t FuelInitFlag = 0u;
uint8_t FuelStateInitFlag = 0u;
uint8_t FuelDir = FUEL_SEG_UP;
FuelSensorSts_t FuelSensorState = FuelSensorNormal;
uint16_t FuelSensorNormalTime = 0u;
uint16_t FuelSensorShortTime = 0u;
uint16_t FuelSensorOpenTime = 0u;
uint8_t FuelADCompleteFlg = 0u;
void Fuel_KL30_Init(void)
{
DesFuelSetp = 0u;
CurFuelSetp = 0u;
FuelInitFlag = 1u;
FuelStateInitFlag = 1u;
FuelDir = FUEL_SEG_UP;
FuelSensorState = FuelSensorNormal;
FuelSensorNormalTime = 0u;
FuelSensorShortTime = 0u;
FuelSensorOpenTime = 0u;
FuelADCompleteFlg = 0u;
// PORT_ClrBit(Fuel_Vcc_en);
}
void Fuel_KL15_Init(void)
{
// PORT_SetBit(Fuel_Vcc_en);
DesFuelSetp = 0u;
CurFuelSetp = 0u;
FuelInitFlag = 1u;
FuelStateInitFlag = 1u;
FuelDir = FUEL_SEG_UP;
FuelSensorState = FuelSensorNormal;
FuelSensorNormalTime = 0u;
FuelSensorShortTime = 0u;
FuelSensorOpenTime = 0u;
FuelADCompleteFlg = 0u;
}
uint16_t TestFuelR = 1100u;
void Fuel_R_Cal(uint8_t deltaTime)
{
uint16_t FuelRes = 0;
uint8_t i, j;
uint32_t temp32;
static uint16_t timeCount = 0;
if(FuelStateInitFlag)
{
FuelR = ADC_Read_Signal(ADC_CH_FUEL1);
}
if (timeCount >= FUEL_DATA_TIME)
{
timeCount = 0;
if (FuelDataCount < FUEL_DATA_NUM)
{
/*获取燃油电阻*/
FuelRes = ADC_Read_Signal(ADC_CH_FUEL1);; // ADC_Read_Signal(ADC_CH_FUEL1);
/*四舍五入*/
//if (FuelRes < 32000)
//{
if (FuelRes % 10 >= 5)
{
FuelRes += 5;
}
//}
//else
//{
// FuelRes = 32000;
//}
/*由小到大插入数据*/
for (i = 0; i < FuelDataCount; i++)
{
if (FuelRes < FuelData[i])
{
break;
}
}
for (j = FuelDataCount; j > i; j--)
{
FuelData[j] = FuelData[j - 1];
}
FuelData[i] = FuelRes;
FuelDataCount++;
}
else
{
/*一组数据采集完毕,取中间部分计算平均值*/
temp32 = 0;
for (i = FUEL_CAL_START; i < FUEL_CAL_END; i++)
{
temp32 += FuelData[i];
}
FuelR = temp32 / (FUEL_CAL_END - FUEL_CAL_START);
FuelDataCount = 0;
FuelADCompleteFlg = 1;
}
}
timeCount += deltaTime;
}
void Fuel_State_Check(uint8_t deltaTime)
{
// if (FuelR < 20)
//{ /*短路 1*/
// FuelSensorOpenTime = 0;
// FuelSensorNormalTime = 0;
// if ((FuelSensorShortTime > 3000) || ((FuelStateInitFlag) && (FuelSensorShortTime > 3000)))
// {
// FuelSensorState = FuelSensorShortCircuit;
// DesFuelSetp = 0;
// CurFuelSetp = 0;
// FuelStateInitFlag = 0;
// FuelInitFlag = 1;
// FuelDir = FUEL_SEG_UP;
// }
// else
// {
// FuelSensorShortTime += deltaTime;
// }
// }
// else
if (FuelR >= 1100)
{ /*断路 320*/
FuelSensorShortTime = 0;
FuelSensorNormalTime = 0;
if ((FuelSensorOpenTime > 2800) || ((FuelStateInitFlag) && (FuelSensorOpenTime > 2800)))
{
FuelSensorState = FuelSensorOpenCircuit;
DesFuelSetp = 0;
CurFuelSetp = 5;
FuelStateInitFlag = 0;
FuelInitFlag = 1;
FuelDir = FUEL_SEG_UP;
}
else
{
FuelSensorOpenTime += deltaTime;
}
}
else
{
FuelSensorShortTime = 0;
FuelSensorOpenTime = 0;
if (FuelSensorNormalTime > 3000)
{
FuelSensorState = FuelSensorNormal;
FuelStateInitFlag = 0;
}
else
{
FuelSensorNormalTime += deltaTime;
}
}
}
void Fuel_Gauges_Cal(uint8_t deltaTime)
{
static uint16_t time = 0;
if ((FuelSensorState == FuelSensorNormal) && (FuelR < 1100))
{ // 32000 //FuelR >10 change FuelR >20
/*采集完第一组数据后,开始计算燃油格数*/
if (FuelADCompleteFlg)
{
if (FuelInitFlag)
{
FuelRBak = FuelR;
}
/*根据回差计算走动方向*/
if (FuelDir == FUEL_SEG_UP)
{
if (FuelR >= FuelRBak + RETURN_DIFFERENCE)
{
FuelDir = FUEL_SEG_DOWN;
FuelRBak = FuelR;
}
if (FuelR < FuelRBak)
{
FuelRBak = FuelR;
}
}
else
{
if (FuelRBak >= FuelR + RETURN_DIFFERENCE)
{
FuelDir = FUEL_SEG_UP;
FuelRBak = FuelR;
}
if (FuelR > FuelRBak)
{
FuelRBak = FuelR;
}
}
/*计算目标格数*/
if (FuelDir == FUEL_SEG_UP)
{
if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR < 240))
{
DesFuelSetp = 5;
}
else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR < 430))
{
DesFuelSetp = 4;
}
else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR < 610))
{
DesFuelSetp = 3;
}
else if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR < 790))
{
DesFuelSetp = 2;
}
else if (((DesFuelSetp == 0) || FuelInitFlag) && (FuelR < 970))
{
DesFuelSetp = 1;
}
}
else if (FuelDir == FUEL_SEG_DOWN)
{
if (((DesFuelSetp == 1) || FuelInitFlag) && (FuelR >= 970))
{
DesFuelSetp = 0;
}
else if (((DesFuelSetp == 2) || FuelInitFlag) && (FuelR >= 790))
{
DesFuelSetp = 1;
}
else if (((DesFuelSetp == 3) || FuelInitFlag) && (FuelR >= 610))
{
DesFuelSetp = 2;
}
else if (((DesFuelSetp == 4) || FuelInitFlag) && (FuelR >= 430))
{
DesFuelSetp = 3;
}
else if (((DesFuelSetp == 5) || FuelInitFlag) && (FuelR >= 240))
{
DesFuelSetp = 4;
}
}
}
/*IGN ON 1秒/故障恢复后,开始走格 立即指向当前格 20220704*/
if (Common_GetIgnOnTime() >= 3000)
{
time += deltaTime;
if (FuelInitFlag)
{
FuelInitFlag = 0;
time = 0;
CurFuelSetp = DesFuelSetp;
}
if (time >= 10000)
{ /* 10S变化一格 */
time = 0;
if (CurFuelSetp < DesFuelSetp)
{
CurFuelSetp++;
}
else if (CurFuelSetp > DesFuelSetp)
{
CurFuelSetp--;
}
}
if (CurFuelSetp == DesFuelSetp)
{
time = 0;
}
}
}
}
uint8_t Get_Fuel_Disp_Byte(void)
{
uint8_t FuelDispByte = 0u;
FuelDispByte = CurFuelSetp;
// if (FuelSensorState == FuelSensorShortCircuit)
//{
// //Short
// FuelDispByte = FLASH_SYNC_1Hz ? 7 : 0;
// }
// else if (FuelSensorState == FuelSensorOpenCircuit)
//{
// //Open
// FuelDispByte = FLASH_SYNC_1Hz ? 6 : 0;
// }
// else if (CurFuelSetp == 1)
//{
// FuelDispByte = FLASH_SYNC_1Hz ? 1 : 0;
// }
//
// else if(CurFuelSetp == 0)
//{
// FuelDispByte = 0;
// }
return FuelDispByte;
}
void Fuel_Cal_Sevice(uint8_t deltaTime)
{
/*检测燃油电阻状态*/
Fuel_State_Check(deltaTime);
/*显示燃油格*/
Fuel_Gauges_Cal(deltaTime);
}
uint8_t Get_CurFuelSetp(void)
{
return CurFuelSetp;
}
FuelSensorSts_t Get_Fuel_Sensor_State(void)
{
return FuelSensorState;
}
#ifndef DATA_FUEL_H
#define DATA_FUEL_H
#include "Components.h"
typedef enum{
FuelSensorNormal = 0,
FuelSensorShortCircuit,
FuelSensorOpenCircuit,
}FuelSensorSts_t;
extern void Fuel_KL15_Init(void);
extern void Fuel_KL30_Init(void);
extern void Fuel_Cal_Sevice(uint8_t deltaTime);
extern uint8_t Get_Fuel_Disp_Byte(void);
extern uint8_t Get_CurFuelSetp(void);
extern FuelSensorSts_t Get_Fuel_Sensor_State(void);
#endif
......@@ -169,18 +169,6 @@ void Gauge_ODO_Display(void)
SEG_SET_ODO_NUM(0u, 0u);
}
}
void Gauge_FuelDial_Display(void)
{
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
{
SEG_SET_FuelDial(1, Get_CurFuelSetp());
}
else
{
SEG_SET_FuelDial(0, 0);
}
}
void Gauge_EspeedDial_Display(void)
{
if ( Common_Get_IG_Sts( ) == COMMON_POWER_ON )
......@@ -236,8 +224,6 @@ void Gauge_Service(void)
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Key_ISTOP, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_02_Normal_Voltage, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_High_Low_Voltage, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_Fuel_W, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Fuel_Y, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Screen_Time, 0);
}
}
......@@ -252,7 +238,6 @@ void Gauge_Service(void)
Gauge_ODO_Display();
Gauge_Clock_Display();
Gauge_Trip_Display();
Gauge_FuelDial_Display();
Gauge_EspeedDial_Display();
SEG_SET_Clock(22,22,1,1,1);
SEG_SET_Fault_Code(1,2222);
......@@ -296,8 +281,6 @@ void Gauge_Service(void)
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Key_ISTOP, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_02_Normal_Voltage, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_High_Low_Voltage, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_Fuel_W, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Fuel_Y, 0);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Screen_Time, 0);
}
}
......
......@@ -49,7 +49,6 @@ void Gauge_DrivingRange_Display(void);
void Gauge_Trip_Display(void);
void Gauge_ODO_Display(void);
//void Gauge_Gear_Display(void);
void Gauge_FuelDial_Display(void);
void Gauge_EspeedDial_Display(void);
void Gauge_Frame_Display(void);
void Gauge_MaintenanceMileage_Display(void);
......
......@@ -2687,21 +2687,6 @@ _Fun_Res SEG_SET_Clock(uint8_t m_hour, uint8_t m_minute, uint8_t m_icon, uint8_t
return m_Res;
}
uint8_t fuel_check_SEG_step = 0;
void SEG_Scan_SET_FuelDial(void)
{
uint8_t a = 0;
a = fuel_check_SEG_step / 10u;
SEG_SET_FuelDial(1, a);
if (fuel_check_SEG_step < 59)
{
fuel_check_SEG_step++;
}
else
{
fuel_check_SEG_step = 0;
}
}
uint8_t Espeed_check_SEG_step = 0;
......@@ -2735,15 +2720,12 @@ uint8_t check_SEG_step = 0;
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Key_ISTOP, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_02_Normal_Voltage, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_03_High_Low_Voltage, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_05_Fuel_Y, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_04_Fuel_W, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_06_Screen_Time, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_29_MPH, LED_ON);
// LED_Driver_Channel_Set(LampChannel_0, LampCh0_30_KM_H, LED_ON);
// RTE_GPIO_Set_Level(VSPEED_TEN_OUT, 1);
// RTE_GPIO_Set_Level(VSPEED_HUNDREDS_OUT, 1);
// SEG_Scan_SET_FuelDial();
// SEG_Scan_SET_EspeedDial();
//
//}
......@@ -2756,21 +2738,17 @@ void Checkself_Init(void)
Checkself_SEG_step_count = 0;
check_SEG_step = 0;
Espeed_check_SEG_step = 0;
fuel_check_SEG_step = 0;
}
void Checkself_SEG_Display(void)
{
uint16_t Vspeed = 0;
uint16_t Espeed = 0;
uint16_t Fuel = 0;
uint16_t Trip = 0;
uint16_t hour = 0;
uint16_t min = 0;
uint32_t ODO = 0;
Fuel = Checkself_SEG_step / 5u;
SEG_SET_FuelDial(1, Fuel);
Espeed = (Checkself_SEG_step * 2 / 5) * 1000;
//SEG_SET_EspeedDial(1, Espeed / 1000, Espeed);
......
......@@ -49,8 +49,8 @@ _Fun_Res SEG_SET_GEAR(uint8_t m_Gear_Flag,uint8_t m_Gear);
/**@brief 电量表盘显示函数*/
_Fun_Res SEG_SET_EleDial(uint8_t m_Flag,uint8_t m_SEG,uint16_t m_NUM);
/**@brief 燃油表盘显示函数*/
_Fun_Res SEG_SET_FuelDial(uint8_t m_Flag,uint8_t m_SEG);
// /**@brief 燃油表盘显示函数*/
// _Fun_Res SEG_SET_FuelDial(uint8_t m_Flag,uint8_t m_SEG);
/**@brief 转速表盘显示函数*/
//_Fun_Res SEG_SET_EspeedDial(uint8_t m_Flag, uint8_t m_SEG, uint16_t m_NUM);
......@@ -99,7 +99,6 @@ _Fun_Res SEG_Scan_SET_PowerDial(uint8_t m_SEG);
/**@brief 刀盘显示函数*/
_Fun_Res SEG_SET_Cutterhead(uint16_t LED_NUM, uint8_t m_Flag);
void SEG_Scan_SET_FuelDial(void);
void SEG_Scan_SET_EspeedDial(void);
//void SEG_Scan_SET_FuelDial_Checkself(void);
......
......@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/3/31 13:14:40
* Date : 2024/6/16 16:49:27
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
......@@ -15,7 +15,7 @@
#include "Analog_Signals.h"
/* Private typedef ----------------------------------------------------------*/
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t u8Ch;
uint8_t u8RefType;
......@@ -26,7 +26,7 @@ typedef struct
ADC_Circuit_Calc_Func pfProcFunc;
}ADC_Ch_Cfg_st_t;
typedef enum ASigConvStat
typedef __attribute__((aligned(4))) enum ASigConvStat
{
ADC_STAT_IDLE = 0,
ADC_STAT_INIT,
......@@ -36,7 +36,7 @@ typedef enum ASigConvStat
ADC_STAT_ERR,
}ADC_Stat_en_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
ADC_Stat_en_t enStatus;
uint8_t u8CurrentCh;
......@@ -44,7 +44,7 @@ typedef struct
uint8_t u8Timer;
}ADC_Ctrl_st_t;
typedef struct
typedef struct __attribute__((aligned(4)))
{
uint8_t u8Valid;
uint8_t u8Rsvd;
......@@ -72,25 +72,21 @@ ADC_Ctrl_st_t stADCCtrl;
uint16_t u16ADCSample[ADC_CONV_CH_NUMBER];
ADC_Data_st_t stADCData[ADC_SIGNAL_CH_NUMBER];
const uint8_t u8ADCChList[ADC_CONV_CH_NUMBER] =
const uint8_t __attribute__((aligned(4))) u8ADCChList[ADC_CONV_CH_NUMBER] =
{
2U, 3U, 7U, 5U,
2U, 3U,
};
const ADC_Ch_Cfg_st_t stADCChCfg[ADC_SIGNAL_CH_NUMBER] =
const __attribute__((aligned(4))) ADC_Ch_Cfg_st_t stADCChCfg[ADC_SIGNAL_CH_NUMBER] =
{
{ 0U, 0U, 0U, 0U, 700U, 1U, ADC_Voltage_Calc_Circuit102,},
{ 0U, 0U, 0U, 0U, 0U, 1U, ADC_Voltage_Calc_Circuit102,},
{ 1U, 0U, 0U, 0U, 0U, 1U, ADC_Voltage_Calc_Circuit102,},
{ 2U, 0U, 0U, 0U, 0U, 1U, ADC_Voltage_Calc_Circuit101,},
{ 3U, 2U, 0U, 2U, 18U, 1U, ADC_Res_Calc_Circuit101,},
};
const ADC_Res_List_st_t stADCResList[ADC_SIGNAL_CH_NUMBER] =
const __attribute__((aligned(4))) ADC_Res_List_st_t stADCResList[ADC_SIGNAL_CH_NUMBER] =
{
{ 3300000U, 1000000U, 0U, 0U,},
{ 3300000U, 1000000U, 0U, 0U,},
{ 0U, 0U, 0U, 0U,},
{ 0U, 0U, 670U, 300U,},
};
/* Private function prototypes ----------------------------------------------*/
......@@ -115,10 +111,11 @@ void Analog_Signal_Conv_Init(void)
}
}
RTE_ADC_Init(0,2);
RTE_ADC_Init(0,3);
RTE_ADC_Init(0,5);
RTE_ADC_Init(0,7);
for (i = 0U; i < ADC_CONV_CH_NUMBER; i++)
{
RTE_ADC_Init(0, u8ADCChList[i]);
}
for (i = 0U; i < ADC_SIGNAL_CH_NUMBER; i++)
{
......
......@@ -4,7 +4,7 @@
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/3/31 13:14:40
* Date : 2024/6/16 16:49:27
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
......@@ -30,13 +30,11 @@ enum ADCChName
{
ADC_CH_KL30_VOLTAGE = 0,
ADC_CH_KL15_VOLTAGE,
ADC_CH_FUEL_VREF,
ADC_CH_FUEL1,
};
/* Exported macro ------------------------------------------------------------*/
#define ADC_TOTAL_CH_NUMBER (4U)
#define ADC_SIGNAL_CH_NUMBER (4U)
#define ADC_TOTAL_CH_NUMBER (2U)
#define ADC_SIGNAL_CH_NUMBER (2U)
#define ADC_REF_VOLTAGE u16ADCRefVoltage
/* Exported variables --------------------------------------------------------*/
......
......@@ -16,12 +16,9 @@
#include "Eeprom\eeManager_Interface.h"
#include "Eeprom\eepromManage.h"
#include "BU98R10\BU98R10.h"
//#include "Key\Key_user.h"
#include "LED_Driver\Simulated_IIC_2_Master.h"
#include "LED_Driver\LED_Driver_Interface.h"
#include "LED_Driver\LED_Driver.h"
#include "Light_Sensor\Light_Sensor.h"
#include "Light_Sensor\Light_Sensor_Interface.h"
#include "Analog\Analog_Signals.h"
#include "Analog\Analog_Circuits.h"
#include "common.h"
......
#ifndef LIGHT_SENSOR_H__
#define LIGHT_SENSOR_H__
/*-------------------------------------------------------------------------------------------*/
// #define LIGHT_SENSOR_PLATFORM_16BIT
#ifdef LIGHT_SENSOR_PLATFORM_16BIT
typedef unsigned char ALS_uint8_t;
typedef unsigned int ALS_uint16_t;
typedef unsigned long ALS_uint32_t;
#else
typedef unsigned char ALS_uint8_t;
typedef unsigned short ALS_uint16_t;
typedef unsigned int ALS_uint32_t;
#endif
/*-------------------------------------------------------------------------------------------*/
#define ALS_VERSIONS 0X01U
typedef void (*ALS_Hanle)(void);
typedef void (*ALS_Hanle_Write)(ALS_uint8_t u8ALSData);
typedef ALS_uint8_t (*ALS_Hanle_Read)(void);
typedef struct
{
ALS_Hanle_Write pfnALSDelay100usCB; /*100us 延时函数*/
ALS_Hanle pfnALSIICStartCB; /*start 函数接口*/
ALS_Hanle pfnALSIICStopCB; /*stop 函数接口*/
ALS_Hanle_Write pfnALSIICTxDataCB; /*发送数据 函数接口*/
ALS_Hanle_Write pfnALSIICTxACKCB; /*发送ACK 函数接口*/
ALS_Hanle_Read pfnALSIICRxDataCB; /*接收数据 函数接口*/
ALS_Hanle_Read pfnALSIICRxACKCB; /*接收ACK 函数接口*/
} Light_Sensor_Par_st_t;
/*-------------------------------------------------------------------------------------------*/
/*
返回0:初始化成功
返回1:初始化失败
*/
extern ALS_uint8_t ALS_Init(Light_Sensor_Par_st_t *pstALSInitPar);
/*根据需要的数据更新频率进行调用*/
extern void ALS_Service(void);
extern ALS_uint16_t ALS_Get_Data0(void);
extern ALS_uint16_t ALS_Get_Data1(void);
/*-------------------------------------------------------------------------------------------*/
#endif
#include "Light_Sensor.h"
#include "Light_Sensor_Interface.h"
#include "Simulated_IIC_2_Master.h"
void ALS_Delay_100us(ALS_uint8_t u8ALSData)
{
ALS_uint32_t ALSDelayCount = 0;
ALS_uint32_t i = 0;
ALS_uint32_t j = 0;
for (j = 0; j < u8ALSData; j++)
{
for (i = 0; i < 1000; i++)
{
ALSDelayCount++;
}
}
}
/****************初始化函数调用示例*************/
void Light_Sensor_Init_Example(void)
{
Light_Sensor_Par_st_t stALSInitPar;
stALSInitPar.pfnALSDelay100usCB = ALS_Delay_100us;
stALSInitPar.pfnALSIICStartCB = Simulated_IIC_2_Start;
stALSInitPar.pfnALSIICStopCB = Simulated_IIC_2_Stop;
stALSInitPar.pfnALSIICTxDataCB = Simulated_IIC_2_Transmit_Data;
stALSInitPar.pfnALSIICTxACKCB = Simulated_IIC_2_Transmit_ACK;
stALSInitPar.pfnALSIICRxDataCB = Simulated_IIC_2_Receive_Data;
stALSInitPar.pfnALSIICRxACKCB = Simulated_IIC_2_Receive_ACK;
ALS_Init(&stALSInitPar);
}
#ifndef LIGHT_SENSOR_INTERFACE_H__
#define LIGHT_SENSOR_INTERFACE_H__
/*-----------------------------------------------------------*/
extern void Light_Sensor_Init_Example(void);
#endif
......@@ -49,28 +49,18 @@ static void Power_KL30_Init(void)
DFlash_init();
Analog_Signal_Conv_Init();
BU98R10_Init();
BackLight_Init();
Sys_KL30_Init();
Checkself_Init();
// Data_Vehicle_Speed_KL30_Init();
// Data_Engine_Speed_KL30_Wakeup_Init();
LINE_IN_Init();
// Key_KL30_Init_EXample();
Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example();//注意顺序2
Data_User_Mileage_KL30Init();
Fuel_KL30_Init();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHB, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHC, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
// Telltales_Auto_Start_Stop();
Telltales_Init();
// MenuData_Unit_Init();
g_stRTCInformation.u8RTCSecond = 0;
g_stRTCInformation.u8RTCMinute = 0;
g_stRTCInformation.u8RTCHour = 0;
......@@ -92,21 +82,11 @@ static void Power_Wakeup_Init(void)
Analog_Signal_Conv_Init();
Data_User_Mileage_WakeupInit();
BU98R10_Init();
BackLight_Init();
Sys_WakeUp_Init();
// Data_Vehicle_Speed_KL30_Init();
// Data_Vehicle_Speed_Wakeup_Init();
// Data_Engine_Speed_KL30_Wakeup_Init();
LINE_IN_Init();
// Key_KL30_Init_EXample();
Line_In_KL15_ON_Init();
Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example();//注意顺序2
Fuel_KL30_Init();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400);
// TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHB, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHC, ActiveLevel_High);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
......@@ -132,12 +112,9 @@ static void Power_IG_OFF_Init(void)
static void Power_IG_ON_Init(void)
{
BackLight_Init();
Checkself_Init();
Line_In_KL15_ON_Init();
Telltales_KL15_Init();
Fuel_KL15_Init();
// Telltales_Auto_Start_Stop();
}
static void Power_Sleep_Init(void)
......
This diff is collapsed.
......@@ -2,23 +2,25 @@
#include "Components.h"
#include "Application.h"
#include "delay.h"
#include "wdt.h"
#define u16Base_Vol 0u
#define u16ENTER_LOW_N_RANGE 7000U
#define u16EXIT_LOW_N_RANGE 8000U
#define u16ENTER_LOW_Y_RANGE 9000U
#define u16EXIT_LOW_Y_RANGE 10000U
#define u16Base_Vol 0u
#define u16ENTER_LOW_N_RANGE 7000U
#define u16EXIT_LOW_N_RANGE 7500U
#define u16ENTER_LOW_Y_RANGE 9000U
#define u16EXIT_LOW_Y_RANGE 10000U
#define u16EXIT_HIGH_Y_RANGE 0xffffu
#define u16ENTER_HIGH_Y_RANGE 0xffffu
#define u16EXIT_HIGH_N_RANGE 0xffffu
#define u16ENTER_HIGH_N_RANGE 0xffffu
#define u16Top_Vol 0xffffu
#define u16EXIT_HIGH_Y_RANGE 15000U
#define u16ENTER_HIGH_Y_RANGE 16000U
#define u16EXIT_HIGH_N_RANGE 18000U
#define u16ENTER_HIGH_N_RANGE 19000U
#define u16Top_Vol 0xffffu
void Delay_ms(uint32_t u32Ms);
// #pragma alignvar(8)
static const monitorlib_uint16_t SysFun_Range[24u] = {
static const monitorlib_uint16_t SysFun_Range [ 26u ] = {
u16Base_Vol,
u16ENTER_LOW_N_RANGE,
......@@ -34,8 +36,8 @@ static const monitorlib_uint16_t SysFun_Range[24u] = {
u16ENTER_HIGH_N_RANGE,
u16Top_Vol,
500, /* 进入异常电压时间 1S */
50u, /* KL15消抖时间 100ms*/
2500,
50u,
u16Base_Vol,
u16ENTER_LOW_N_RANGE,
......@@ -53,33 +55,36 @@ static const monitorlib_uint16_t SysFun_Range[24u] = {
u16Top_Vol,
2u,
2u,
2u,
0u,
};
monitorlib_uint16_t Sys_Read_KL30_Voltage_F(void)
{
monitorlib_uint16_t u16Voltage;
u16Voltage = ADC_Conv_Single_Channel(ADC_CH_KL30_VOLTAGE);
u16Voltage = (monitorlib_uint16_t)ADC_Conv_Single_Channel(ADC_CH_KL30_VOLTAGE);
return u16Voltage;
}
monitorlib_uint16_t Sys_Read_KL15_Voltage_F(void)
{
monitorlib_uint16_t u16Voltage;
u16Voltage = ADC_Conv_Single_Channel(ADC_CH_KL15_VOLTAGE);
u16Voltage = (monitorlib_uint16_t)ADC_Conv_Single_Channel(ADC_CH_KL15_VOLTAGE);
return u16Voltage;
}
monitorlib_uint16_t Sys_Read_KL30_Voltage(void)
{
monitorlib_uint16_t u16Voltage;
u16Voltage = ADC_Read_Signal(ADC_CH_KL30_VOLTAGE);
u16Voltage = (monitorlib_uint16_t)ADC_Read_Signal(ADC_CH_KL30_VOLTAGE);
return u16Voltage;
}
monitorlib_uint16_t Sys_Read_KL15_Voltage(void)
{
monitorlib_uint16_t u16Voltage;
u16Voltage = ADC_Read_Signal(ADC_CH_KL15_VOLTAGE);
u16Voltage = (monitorlib_uint16_t)ADC_Read_Signal(ADC_CH_KL15_VOLTAGE);
return u16Voltage;
}
......@@ -99,17 +104,20 @@ monitorlib_uint8_t Sys_Read_KL15_Valid(void)
monitorlib_uint8_t System_LINE_KL15(void)
{
monitorlib_uint8_t u8KL15 = 0;
static monitorlib_uint8_t u8KL15 = 0;
if (RTE_GPIO_Get_Level(KL15_AD_IN) == 1u)
if (Sys_Read_KL15_Voltage() >= 5500u )
{
u8KL15 = 1u;
}
else
else if((Sys_Read_KL15_Voltage() >= 5000u)&&(Sys_Read_KL15_Voltage() < 5500u))
{
;
}
else
{
u8KL15 = 0;
}
return u8KL15;
}
......@@ -125,33 +133,33 @@ void Sys_LogicProcess(void)
void Sys_KL30_Init(void)
{
MonitorExt_st m_st;
m_st.COM_Delay = Common_BlockDelay;
m_st.SysGet_KL15Line = System_LINE_KL15;
m_st.SysGet_KL15_Valid = Sys_Read_KL15_Valid;
m_st.SysGet_KL30_Valid = Sys_Read_KL30_Valid;
m_st.SysGet_KL15_value = Sys_Read_KL15_Voltage;
m_st.SysGet_KL30_value = Sys_Read_KL30_Voltage;
m_st.COM_Delay = Common_BlockDelay;
m_st.SysGet_KL15Line = System_LINE_KL15;
m_st.SysGet_KL15_Valid = Sys_Read_KL15_Valid;
m_st.SysGet_KL30_Valid = Sys_Read_KL30_Valid;
m_st.SysGet_KL15_value = Sys_Read_KL15_Voltage;
m_st.SysGet_KL30_value = Sys_Read_KL30_Voltage;
m_st.SysGet_KL15_value_Force = Sys_Read_KL15_Voltage_F;
m_st.SysGet_KL30_value_Force = Sys_Read_KL30_Voltage_F;
m_st.SysMonitorLogic = Sys_LogicProcess;
System_Monitor_KL30Init();
m_st.SysMonitorLogic = Sys_LogicProcess;
Sys_Set_Pata(SysFun_Range, &m_st);
System_Monitor_KL30Init( );
}
void Sys_WakeUp_Init(void)
{
MonitorExt_st m_st;
m_st.COM_Delay = Common_BlockDelay;
m_st.SysGet_KL15Line = System_LINE_KL15;
m_st.SysGet_KL15_Valid = Sys_Read_KL15_Valid;
m_st.SysGet_KL30_Valid = Sys_Read_KL30_Valid;
m_st.SysGet_KL15_value = Sys_Read_KL15_Voltage;
m_st.SysGet_KL30_value = Sys_Read_KL30_Voltage;
m_st.COM_Delay = Common_BlockDelay;
m_st.SysGet_KL15Line = System_LINE_KL15;
m_st.SysGet_KL15_Valid = Sys_Read_KL15_Valid;
m_st.SysGet_KL30_Valid = Sys_Read_KL30_Valid;
m_st.SysGet_KL15_value = Sys_Read_KL15_Voltage;
m_st.SysGet_KL30_value = Sys_Read_KL30_Voltage;
m_st.SysGet_KL15_value_Force = Sys_Read_KL15_Voltage_F;
m_st.SysGet_KL30_value_Force = Sys_Read_KL30_Voltage_F;
m_st.SysMonitorLogic = Sys_LogicProcess;
System_Monitor_WakeupInit();
m_st.SysMonitorLogic = Sys_LogicProcess;
Sys_Set_Pata(SysFun_Range, &m_st);
System_Monitor_WakeupInit( );
}
void Delay_ms(uint32_t u32Ms)
......
......@@ -4,8 +4,9 @@
#include "cgc.h"
#include "gpio.h"
#include "isr.h"
#include "Analog\Analog_Signals.h"
uint8_t u8NewChNum[4] = {2, 3, 7, 5};
// uint8_t u8NewChNum[4] = {2, 3, 7, 5};
void RTC_ADC_Interrupt(void *msg)
{
......@@ -17,6 +18,7 @@ void RTE_ADC_Init(const uint8_t u8ChList[], uint8_t u8ChNum)
{
GPIO_InitTypeDef GPIO_InitStructure = {0};
ADC_InitTypeDef ADC_InitStructure = {0};
if(u8ChNum<=7)
{
......@@ -133,13 +135,13 @@ void RTE_ADC_Get_Conversion_Result(uint16_t *pu16Data, uint8_t u8ChNum)
uint8_t i;
if ((pu16Data != 0U) && (u8ChNum > 0U) && (u8ChNum <= 4U))
if ((pu16Data != 0U) && (u8ChNum > 0U) && (u8ChNum <= ADC_TOTAL_CH_NUMBER))
{
if (RTE_ADC_Get_Conversion_Status() == 0U)
{
for (i = 0U; i < u8ChNum; i++)
{
ADC_Converse(u8NewChNum[i], 1, pu16Data);
ADC_Converse((ADC_Channel_t)u8ADCChList[i], 1, pu16Data);
pu16Data++;
}
}
......
......@@ -4,6 +4,8 @@
#include <stdint.h>
extern const uint8_t u8ADCChList[];
#define ADC_RESOLUTION (4096U) /* 12bit ADC */
extern void RTE_ADC_Init(const uint8_t u8ChList[], uint8_t u8ChNum);
......
......@@ -41,11 +41,8 @@ void Sys_5ms_Tasks(void)
void Sys_10ms_Tasks(void)
{
Line_In_Debounce_Service(10u);
// Key_Service();
Data_Mileage_Write_EEPROM();
Can_BusOff_Recover(10u);
// Turn_Left_Right_Lamp();
// Fuel_R_Cal(10u);
TYW_Check_Count();
}
......@@ -76,7 +73,6 @@ void Sys_100ms_Tasks(void)
// counter_val.time.RTC_Hours = RTC_Bcd2ToByte(counter_val.time.RTC_Hours);
// counter_val.time.RTC_Minutes = RTC_Bcd2ToByte(counter_val.time.RTC_Minutes);
// }
Fuel_Cal_Sevice(100u);
BackLight_Process();
Interact_Light_Process();
// Services_Mileage_Callback();
......@@ -87,7 +83,7 @@ void Sys_100ms_Tasks(void)
u8LEDDriverCheckCount = 0U;
LED_Driver_Work_Check();
LED_Driver_Service_Immediate();//注意顺序1
ALS_Service();//注意顺序2
}
else
{
......
# 2024.03.20
添加回滚App的功能
添加更新Boot程序的功能
添加校验App正确性的功能
# 2024.03.15
上传初版程序
\ No newline at end of file
VERSION ""
NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_
CAT_
FILTER
BA_DEF_DEF_
EV_DATA_
ENVVAR_DATA_
SGTYPE_
SGTYPE_VAL_
BA_DEF_SGTYPE_
BA_SGTYPE_
SIG_TYPE_REF_
VAL_TABLE_
SIG_GROUP_
SIG_VALTYPE_
SIGTYPE_VALTYPE_
BO_TX_BU_
BA_DEF_REL_
BA_REL_
BA_DEF_DEF_REL_
BU_SG_REL_
BU_EV_REL_
BU_BO_REL_
SG_MUL_VAL_
BS_:
BU_: Haojin232
VAL_TABLE_ ECU_Battery_Voltage ;
VAL_TABLE_ ECU_Warning_Lamp 1 "ON" 0 "OFF" ;
VAL_TABLE_ ECU_Vehicle_Speed ;
VAL_TABLE_ ECU_Engine_Speed ;
VAL_TABLE_ Key_ISTOP 1 "Enable" 0 "Unenable" ;
BO_ 1280 CAN_0x500: 8 Vector__XXX
SG_ Key_ISTOP : 0|1@0+ (1,0) [0|1] "" Vector__XXX
BO_ 1026 CAN_0x402: 8 Haojin232
SG_ ECU_Warning_Lamp : 63|1@0+ (1,0) [0|1] "" Vector__XXX
BO_ 1025 CAN_0x401: 8 Haojin232
SG_ ECU_Battery_Voltage : 23|8@0+ (0.1,0) [0|255] "" Vector__XXX
BO_ 257 CAN_0x101: 3 Haojin232
SG_ ECU_Vehicle_Speed : 23|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ECU_Engine_Speed : 7|16@0+ (0.25,0) [0|65535] "" Vector__XXX
BA_DEF_ "BusType" STRING ;
BA_DEF_ BU_ "NodeLayerModules" STRING ;
BA_DEF_ BU_ "ECU" STRING ;
BA_DEF_ BU_ "CANoeJitterMax" INT 0 0;
BA_DEF_ BU_ "CANoeJitterMin" INT 0 0;
BA_DEF_ BU_ "CANoeDrift" INT 0 0;
BA_DEF_ BU_ "CANoeStartDelay" INT 0 0;
BA_DEF_DEF_ "BusType" "";
BA_DEF_DEF_ "NodeLayerModules" "";
BA_DEF_DEF_ "ECU" "";
BA_DEF_DEF_ "CANoeJitterMax" 0;
BA_DEF_DEF_ "CANoeJitterMin" 0;
BA_DEF_DEF_ "CANoeDrift" 0;
BA_DEF_DEF_ "CANoeStartDelay" 0;
VAL_ 1280 Key_ISTOP 1 "Enable" 0 "Unenable" ;
VAL_ 1026 ECU_Warning_Lamp 1 "ON" 0 "OFF" ;
//******************************BUSMASTER Messages and signals Database ******************************//
[DATABASE_VERSION] 1.3
[PROTOCOL] CAN
[BUSMASTER_VERSION] [3.2.2]
[NUMBER_OF_MESSAGES] 15
[START_MSG] CAN_0x393,915,8,7,1,S
[START_SIGNALS] ICU_HardVer,8,1,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SubHardVer,8,2,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SoftVer,8,3,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SubSoftVer,8,4,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SoftPhaseVer,8,5,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_ProtoVer,8,6,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_ProtoSubVer,8,7,0,U,255,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x398,920,8,6,1,S
[START_SIGNALS] ICU_SN5,8,1,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SN4,8,2,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SN3,8,3,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SN2,8,4,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SN1,8,5,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SN0,8,6,0,U,255,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x39D,925,8,6,1,S
[START_SIGNALS] ICU_ProductName,16,2,0,U,65535,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_ProductCode,16,4,0,U,65535,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_CustomerCode,8,5,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_ProductYear,8,6,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_ProductMon,8,7,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_ProductDay,8,8,0,U,255,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x3A2,930,8,13,1,S
[START_SIGNALS] ICU_POWERStateFB,4,1,0,U,15,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_KL15State,1,1,4,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_LEDLightState,1,1,5,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_BuzzerState,1,1,6,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_IndicatorLightState,3,2,0,U,7,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_IndicatorLightPowerState,1,2,3,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_GrassFullState,1,2,4,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_kEY_AState,1,2,5,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_kEY_BState,1,2,6,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_kEY_CState,1,2,7,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_kEY_DState,1,3,0,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_kEY_EState,1,3,1,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_BluetoothConnectState,3,3,4,U,7,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x3A7,935,8,4,1,S
[START_SIGNALS] ICU_MasterBMSCommunicatlost,1,1,0,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_SlaveBMSCommunicatlost,1,1,1,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_MCUCommunicatlost,1,1,2,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] ICU_VCUCommunicatlost,1,1,3,U,1,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x157,343,8,3,1,S
[START_SIGNALS] BMCU_PTOSwicthState,1,1,3,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] BMCU_BladeSpeedGear,3,1,4,U,7,0,0,0.000000,1.000000,,
[START_SIGNALS] BMCU_ErrorGrage,3,5,0,U,7,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x38E,910,8,2,1,S
[START_SIGNALS] BMCU_Moto1_Locked_RotorFault,1,2,0,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] BMCU_Moto2_Locked_RotorFault,1,2,1,U,1,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x18200A20,404752928,8,1,1,X
[START_SIGNALS] MBMS_Soc,8,5,0,U,255,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x18202922,404760866,8,4,1,X
[START_SIGNALS] MBMS_TOTALSigCharge,1,1,0,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] MBMS_TOTALSigAcc,1,1,1,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] MBMS_TOTALSigOn,1,1,2,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] MBMS_TOTALWorkState,3,2,0,U,7,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x18203020,404762656,8,1,1,X
[START_SIGNALS] MBMS_StatSoc,8,5,0,U,255,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x18203220,404763168,8,2,1,X
[START_SIGNALS] MBMS_StatBattWorkState,4,1,0,U,15,0,0,0.000000,1.000000,,
[START_SIGNALS] MBMS_StatBattChargeState,3,2,0,U,7,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x125,293,8,10,1,S
[START_SIGNALS] MMCU_WorkState,2,1,0,U,3,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_PowerMode,4,1,2,U,15,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_TravelSpeedGear,2,2,0,U,3,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_EBSState,2,2,6,U,3,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_LockMotoState,1,3,0,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_SeatDetectState,1,3,1,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_ParkingGearState,1,3,7,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_DCDCEnableState,1,4,1,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_ChgProtectState,1,4,2,U,1,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_ErrorGrage,3,7,0,U,7,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x339,825,8,2,1,S
[START_SIGNALS] MMCU_SingleWorkingHours,8,6,0,U,255,0,0,0.000000,1.000000,,
[START_SIGNALS] MMCU_AccumulatedWorkHours,16,8,0,U,65535,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x18200A21,404752929,8,1,1,X
[START_SIGNALS] SBMS_Soc,8,5,0,U,255,0,0,0.000000,1.000000,,
[END_MSG]
[START_MSG] CAN_0x134,308,8,1,1,S
[START_SIGNALS] SMCU_ErrorGrage,3,3,0,U,7,0,0,0.000000,1.000000,,
[END_MSG]
\ No newline at end of file
VERSION ""
BS_:
BU_:
BO_ 915 CAN_0x393: 8 Vector__XXX
SG_ ICU_ProtoSubVer : 55|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_ProtoVer : 47|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_SoftPhaseVer : 39|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_SubSoftVer : 31|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_SoftVer : 23|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_SubHardVer : 15|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_HardVer : 7|8@0+ (1,0) [0|255] "" Vector__XXX
BO_ 920 CAN_0x398: 8 Vector__XXX
SG_ ICU_SN0 : 47|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_SN1 : 39|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_SN2 : 31|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_SN3 : 23|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_SN4 : 15|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_SN5 : 7|8@0+ (1,0) [0|255] "" Vector__XXX
BO_ 925 CAN_0x39D: 8 Vector__XXX
SG_ ICU_ProductDay : 63|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_ProductMon : 55|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_ProductYear : 47|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_CustomerCode : 39|8@0+ (1,0) [0|255] "" Vector__XXX
SG_ ICU_ProductCode : 23|16@0+ (1,0) [0|65535] "" Vector__XXX
SG_ ICU_ProductName : 7|16@0+ (1,0) [0|65535] "" Vector__XXX
BO_ 930 CAN_0x3A2: 8 Vector__XXX
SG_ ICU_BluetoothConnectState : 22|3@0+ (1,0) [0|7] "" Vector__XXX
SG_ ICU_kEY_EState : 17|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_kEY_DState : 16|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_kEY_CState : 15|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_kEY_BState : 14|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_kEY_AState : 13|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_GrassFullState : 12|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_IndicatorLightPowerState : 11|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_IndicatorLightState : 10|3@0+ (1,0) [0|7] "" Vector__XXX
SG_ ICU_BuzzerState : 6|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_LEDLightState : 5|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_KL15State : 4|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_POWERStateFB : 3|4@0+ (1,0) [0|15] "" Vector__XXX
BO_ 935 CAN_0x3A7: 8 Vector__XXX
SG_ ICU_VCUCommunicatlost : 3|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_MCUCommunicatlost : 2|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_SlaveBMSCommunicatlost : 1|1@0- (1,0) [0|1] "" Vector__XXX
SG_ ICU_MasterBMSCommunicatlost : 0|1@0- (1,0) [0|1] "" Vector__XXX
BO_ 343 CAN_0x157: 8 Vector__XXX
SG_ BMCU_ErrorGrage : 34|3@0+ (1,0) [0|7] "" Vector__XXX
SG_ BMCU_BladeSpeedGear : 6|3@0+ (1,0) [0|7] "" Vector__XXX
SG_ BMCU_PTOSwicthState : 3|1@0- (1,0) [0|1] "" Vector__XXX
BO_ 910 CAN_0x38E: 8 Vector__XXX
SG_ BMCU_Moto2_Locked_RotorFault : 9|1@0- (1,0) [0|1] "" Vector__XXX
SG_ BMCU_Moto1_Locked_RotorFault : 8|1@0- (1,0) [0|1] "" Vector__XXX
BO_ 2552236576 CAN_0x18200A20: 8 Vector__XXX
SG_ MBMS_Soc : 39|8@0+ (1,0) [0|255] "" Vector__XXX
BO_ 2552244514 CAN_0x18202922: 8 Vector__XXX
SG_ MBMS_TOTALWorkState : 10|3@0+ (1,0) [0|7] "" Vector__XXX
SG_ MBMS_TOTALSigOn : 2|1@0- (1,0) [0|1] "" Vector__XXX
SG_ MBMS_TOTALSigAcc : 1|1@0- (1,0) [0|1] "" Vector__XXX
SG_ MBMS_TOTALSigCharge : 0|1@0- (1,0) [0|1] "" Vector__XXX
BO_ 2552246304 CAN_0x18203020: 8 Vector__XXX
SG_ MBMS_StatSoc : 39|8@0+ (1,0) [0|255] "" Vector__XXX
BO_ 2552246816 CAN_0x18203220: 8 Vector__XXX
SG_ MBMS_StatBattChargeState : 10|3@0+ (1,0) [0|7] "" Vector__XXX
SG_ MBMS_StatBattWorkState : 3|4@0+ (1,0) [0|15] "" Vector__XXX
BO_ 293 CAN_0x125: 8 Vector__XXX
SG_ MMCU_ErrorGrage : 50|3@0+ (1,0) [0|7] "" Vector__XXX
SG_ MMCU_ChgProtectState : 26|1@0- (1,0) [0|1] "" Vector__XXX
SG_ MMCU_DCDCEnableState : 25|1@0- (1,0) [0|1] "" Vector__XXX
SG_ MMCU_ParkingGearState : 23|1@0- (1,0) [0|1] "" Vector__XXX
SG_ MMCU_SeatDetectState : 17|1@0- (1,0) [0|1] "" Vector__XXX
SG_ MMCU_LockMotoState : 16|1@0- (1,0) [0|1] "" Vector__XXX
SG_ MMCU_EBSState : 15|2@0+ (1,0) [0|3] "" Vector__XXX
SG_ MMCU_TravelSpeedGear : 9|2@0+ (1,0) [0|3] "" Vector__XXX
SG_ MMCU_PowerMode : 5|4@0+ (1,0) [0|15] "" Vector__XXX
SG_ MMCU_WorkState : 1|2@0+ (1,0) [0|3] "" Vector__XXX
BO_ 825 CAN_0x339: 8 Vector__XXX
SG_ MMCU_AccumulatedWorkHours : 55|16@0+ (1,0) [0|65535] "" Vector__XXX
SG_ MMCU_SingleWorkingHours : 47|8@0+ (1,0) [0|255] "" Vector__XXX
BO_ 2552236577 CAN_0x18200A21: 8 Vector__XXX
SG_ SBMS_Soc : 39|8@0+ (1,0) [0|255] "" Vector__XXX
BO_ 308 CAN_0x134: 8 Vector__XXX
SG_ SMCU_ErrorGrage : 18|3@0+ (1,0) [0|7] "" Vector__XXX
/**************************************************************************//**
* \file Analog_Signals.h
* \brief Analog signal processing
* \attention
*
* This file is automatically generated by analog signals configuration tool.
* Date : 2024/6/16 16:49:27
* Cfg Tool Ver : 1.1.0
* Engineer : ShiHao
* (c) Heilongjiang TYW electronics co., LTD
*
******************************************************************************/
#ifndef ANALOG_SIGNALS_H__
#define ANALOG_SIGNALS_H__
/* Includes -----------------------------------------------------------------*/
#include "ADC.h"
#include "Analog_Circuits.h"
#include "RTE.h"
/* C binding of definitions if building with C++ compiler */
#ifdef __cplusplus
extern {
#endif
/*! @{ */
/* Exported types ------------------------------------------------------------*/
enum ADCChName
{
ADC_CH_KL30_VOLTAGE = 0,
ADC_CH_KL15_VOLTAGE,
};
/* Exported macro ------------------------------------------------------------*/
#define ADC_TOTAL_CH_NUMBER (2U)
#define ADC_SIGNAL_CH_NUMBER (2U)
#define ADC_REF_VOLTAGE u16ADCRefVoltage
/* Exported variables --------------------------------------------------------*/
extern volatile uint16_t u16ADCRefVoltage;
extern const uint8_t u8ADCChList[];
/* Exported functions --------------------------------------------------------*/
extern void Analog_Signal_Conv_Init(void);
extern void Analog_Signal_Conv_Stop(void);
extern void Analog_Signal_Conv_Service(void);
extern uint16_t ADC_Read_Signal(uint8_t u8ADCCh);
extern uint8_t ADC_Read_Signal_Valid(uint8_t u8ADCCh);
extern uint16_t ADC_Conv_Single_Channel(uint8_t u8ADCCh);
/*! @} */
#ifdef __cplusplus
}
#endif
#endif /* ANALOG_SIGNALS_H__ */
This diff is collapsed.
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