Commit a4e6006a authored by 郑萍's avatar 郑萍

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

parents b4668b50 98da5d06
......@@ -275,7 +275,7 @@
</OCR_RVCT3>
<OCR_RVCT4>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<StartAddress>0xc400</StartAddress>
<Size>0x73c00</Size>
</OCR_RVCT4>
<OCR_RVCT5>
......@@ -1018,6 +1018,11 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor_User.h</FilePath>
</File>
<File>
<FileName>System_Monitor.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor.lib</FilePath>
</File>
</Files>
</Group>
<Group>
......
#include "Backlight.h"
#include "Components.h"
#define BACK_LIGHT_Val_1 100
#define BACK_LIGHT_Val_2 300
#define BACK_LIGHT_Val_3 500
#define BACK_LIGHT_Val_4 700
#define BACK_LIGHT_Val_5 900
typedef void (*SetPwm)(Light_uint16_t Pwm);
typedef Light_uint8_t (*SetPwmEnable)(void);
typedef Light_uint8_t (*SetPwmLevel)(void);
typedef Light_uint16_t (*NtcRes)(void);
typedef struct
{
SetPwm SetPwmCbk; /* 设置PWM回调函数 */
SetPwmEnable SetPwmEnCbk; /* 设置PWM使能回调函数 */
SetPwmLevel SetPwmLevelCbk; /* 背光等级回调函数 */
NtcRes NtcResCbk; /* 获取电阻值回调函数 */
} BackLightExtPara;
typedef struct
{
SetPwm SetPwmCbk; /* 设置PWM回调函数 */
SetPwmEnable SetPwmEnCbk; /* 设置PWM使能回调函数 */
SetPwmLevel SetPwmLevelCbk; /* 背光等级回调函数 */
NtcRes NtcResCbk;
Light_uint8_t BacklightEn; /* 背光使能 */
Light_uint16_t BacklightPwm; /* 背光PWM */
Light_uint16_t BacklightLevel; /* 背光等级 */
} _Backlight_Op;
_Backlight_Op Backlight_Operate;
#define BACK_LIGHT_Val_1 (( 100 * Backlight_Operate.BacklightPwm ) / 100 )
#define BACK_LIGHT_Val_2 (( 200 * Backlight_Operate.BacklightPwm ) / 100 )
#define BACK_LIGHT_Val_3 (( 400 * Backlight_Operate.BacklightPwm ) / 100 )
#define BACK_LIGHT_Val_4 (( 600 * Backlight_Operate.BacklightPwm ) / 100 )
#define BACK_LIGHT_Val_5 (( 800 * Backlight_Operate.BacklightPwm ) / 100 )
#define LIGHT_DATA_TIME 10u /*这里填写多长时间采集一个数据,单位ms*/
#define LIGHT_DATA_NUM 20u /*燃油电阻采集数据总数 最大255*/
......@@ -34,15 +60,15 @@ typedef struct
_st_Backlight BacklightTable[Backlight_Max] =
{
/*温度 阻值 */
{550, 2708},
{600, 2602},
{650, 2500},
{700, 2043},
{750, 2310},
{800, 2221},
{850, 2136},
{900, 2055},
{950, 1977},
{550, 2708},
{600, 2602},
{650, 2500},
{700, 2043},
{750, 2310},
{800, 2221},
{850, 2136},
{900, 2055},
{950, 1977},
{1000, 1902},
};
_st_BacklightLevel BacklightLevelTable[BacklightLevel_Max] =
......@@ -136,11 +162,11 @@ void Data_Light_Res_service(Light_uint8_t deltaTime)//获取光感阻值,并
}
if(LightR_Status == 0)
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 200);
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_Val_2);
}
else
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 800);
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_Val_5);
}
}
}
......@@ -148,23 +174,23 @@ void Data_Light_Res_service(Light_uint8_t deltaTime)//获取光感阻值,并
{
if(Backlight_SetPwmLevel() == 1U)
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 100);
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_Val_1);
}
else if(Backlight_SetPwmLevel() == 2U)
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 200);
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_Val_2);
}
else if(Backlight_SetPwmLevel() == 3U)
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 400);
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_Val_3);
}
else if(Backlight_SetPwmLevel() == 4U)
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 600);
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_Val_4);
}
else if(Backlight_SetPwmLevel() == 5U)
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 800);
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_Val_5);
}
}
else
......@@ -187,31 +213,8 @@ Light_uint16_t GetBacklightDutyByLevel(Light_uint16_t level)
return 0;
}
typedef void (*SetPwm)(Light_uint16_t Pwm);
typedef Light_uint8_t (*SetPwmEnable)(void);
typedef Light_uint8_t (*SetPwmLevel)(void);
typedef Light_uint16_t (*NtcRes)(void);
typedef struct
{
SetPwm SetPwmCbk; /* 设置PWM回调函数 */
SetPwmEnable SetPwmEnCbk; /* 设置PWM使能回调函数 */
SetPwmLevel SetPwmLevelCbk; /* 背光等级回调函数 */
NtcRes NtcResCbk; /* 获取电阻值回调函数 */
} BackLightExtPara;
typedef struct
{
SetPwm SetPwmCbk; /* 设置PWM回调函数 */
SetPwmEnable SetPwmEnCbk; /* 设置PWM使能回调函数 */
SetPwmLevel SetPwmLevelCbk; /* 背光等级回调函数 */
NtcRes NtcResCbk;
Light_uint8_t BacklightEn; /* 背光使能 */
Light_uint16_t BacklightPwm; /* 背光PWM */
Light_uint16_t BacklightLevel; /* 背光等级 */
} _Backlight_Op;
_Backlight_Op Backlight_Operate;
/* 设置PWM回调函数 */
......@@ -494,7 +497,7 @@ void BackLight_Service(void)
BacklightFactorCtrl.curFactor = BacklightFactorCtrl.destFactor;
}
BacklightFactorCtrl.u16DialdestDuty = BacklightFactorCtrl.curFactor * BacklightFactorCtrl.curFactor / 100;
BacklightFactorCtrl.u16DialdestDuty = Backlight_Operate.BacklightPwm * BacklightFactorCtrl.curFactor / 100;
if (BacklightFactorCtrl.u16DialdestDuty < 50)
{
......@@ -518,17 +521,19 @@ void BackLight_Service(void)
}
Backlight_Operate.BacklightPwm = BacklightFactorCtrl.u16DialcurDuty;
Backlight_Operate.SetPwmCbk(Backlight_Operate.BacklightPwm);
// Backlight_Operate.SetPwmCbk(Backlight_Operate.BacklightPwm);
}
else
{
/* 无NTC策略 直接根据当前背光等级调整PWM */
Backlight_Operate.SetPwmCbk(Backlight_Operate.BacklightPwm);
Backlight_Operate.BacklightPwm = 100U;
// Backlight_Operate.SetPwmCbk(Backlight_Operate.BacklightPwm);
}
}
else
{
Backlight_Operate.SetPwmCbk(0);
Backlight_Operate.BacklightPwm = 100U;
// Backlight_Operate.SetPwmCbk(0);
}
}
......@@ -538,7 +543,7 @@ void BackLight_Process(void)
{
if(Menu_Item_Select_Get(MENU_ITEM_BACKLIGHT_5) == 1)
{
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, BACK_LIGHT_Val_5);
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, (BACK_LIGHT_Val_5));
}
else if(Menu_Item_Select_Get(MENU_ITEM_BACKLIGHT_4) == 1)
{
......
......@@ -25,7 +25,7 @@ extern Light_uint16_t LightR_Status ;
void Backlight_KL30_Wakeup_Init(void);
void BackLight_Process(void);
Light_uint8_t Backlight_SetPwmLevel(void);
extern void BackLight_Service(void);
......
......@@ -41,7 +41,8 @@ uint8_t Common_Get_IG_Sts(void)
uint16_t Common_Get_Act_V_Speed(void)
{
return Act_V_Speed;
uint32_t Act_V_Speed_ODO = Act_V_Speed;
return Act_V_Speed_ODO * 1005 / 1000;//需要跑大计测试
}
uint16_t Common_Get_Disp_V_Speed(void)
{
......
......@@ -1478,15 +1478,15 @@ void AMT630H_GUI_Display_Mode_Setting(Menu_Item_en_t display_mode) /*图 显示
SetPagePic(GRAPHICS_PAGE_0, Pic_0073_456_257);
SetPagePic(GRAPHICS_PAGE_0, Pic_0074_422_103);
}
if(Menu_Item_Select_Get(MENU_ITEM_SELECT_DAYTIME) == 1)
{
g_u8Display_Mode = ModeDAY;
g_u8Display_Mode_select = ModeDAY;
}
else
{
;
}
// if(Menu_Item_Select_Get(MENU_ITEM_SELECT_DAYTIME) == 1)
// {
// g_u8Display_Mode = ModeDAY;
// g_u8Display_Mode_select = ModeDAY;
// }
// else
// {
// ;
// }
break;
case MENU_ITEM_SELECT_NIGHTTIME:
if(g_u8Language == CH)/*处于日间模式 进入显示模式设置 :中文 光标选中夜间模式*/
......@@ -1509,15 +1509,15 @@ void AMT630H_GUI_Display_Mode_Setting(Menu_Item_en_t display_mode) /*图 显示
SetPagePic(GRAPHICS_PAGE_0, Pic_0077_414_234);
SetPagePic(GRAPHICS_PAGE_0, Pic_0076_461_118);
}
if(Menu_Item_Select_Get(MENU_ITEM_SELECT_NIGHTTIME) == 1)
{
g_u8Display_Mode = ModeNIGHT;
g_u8Display_Mode_select = ModeNIGHT;
}
else
{
;
}
// if(Menu_Item_Select_Get(MENU_ITEM_SELECT_NIGHTTIME) == 1)
// {
// g_u8Display_Mode = ModeNIGHT;
// g_u8Display_Mode_select = ModeNIGHT;
// }
// else
// {
// ;
// }
break;
case MENU_ITEM_SELECT_AUTO:
if(g_u8Language == CH)/*处于日间模式 进入显示模式设置 :中文 光标选中自动模式*/
......@@ -1541,7 +1541,7 @@ void AMT630H_GUI_Display_Mode_Setting(Menu_Item_en_t display_mode) /*图 显示
}
if(Menu_Item_Select_Get(MENU_ITEM_SELECT_AUTO) == 1)
{
g_u8Display_Mode_select = ModeATUO;
// g_u8Display_Mode_select = ModeATUO;
if(LightR_Status == 0)
{
g_u8Display_Mode = ModeNIGHT;
......
......@@ -57,7 +57,8 @@ extern uint8_t GET_Backlight(void);
extern uint8_t g_u8Display_Mode;
extern uint8_t g_u8Display_Mode_select;
......
......@@ -36,6 +36,7 @@
#include "Telltales\Telltales_user.h"
#include "Telltales\Telltales_Lib.h"
#include "Application\BlueTooth.h"
#include "cgc.h"
#endif
......@@ -202,6 +202,8 @@ void Menu_Logic_Operation_Select_Daytime(Menu_Key_en_t enKeyType)
Menu_Item_Select_Set(MENU_ITEM_SELECT_DAYTIME, 1);
Menu_Item_Select_Set(MENU_ITEM_SELECT_NIGHTTIME, 0);
Menu_Item_Select_Set(MENU_ITEM_SELECT_AUTO, 0);
g_u8Display_Mode = ModeDAY;
g_u8Display_Mode_select = ModeDAY;
}
}
......@@ -212,6 +214,8 @@ void Menu_Logic_Operation_Select_Nighttime(Menu_Key_en_t enKeyType)
Menu_Item_Select_Set(MENU_ITEM_SELECT_DAYTIME, 0);
Menu_Item_Select_Set(MENU_ITEM_SELECT_NIGHTTIME, 1);
Menu_Item_Select_Set(MENU_ITEM_SELECT_AUTO, 0);
g_u8Display_Mode = ModeNIGHT;
g_u8Display_Mode_select = ModeNIGHT;
}
}
......@@ -222,6 +226,7 @@ void Menu_Logic_Operation_Select_Auto(Menu_Key_en_t enKeyType)
Menu_Item_Select_Set(MENU_ITEM_SELECT_DAYTIME, 0);
Menu_Item_Select_Set(MENU_ITEM_SELECT_NIGHTTIME, 0);
Menu_Item_Select_Set(MENU_ITEM_SELECT_AUTO, 1);
g_u8Display_Mode_select = ModeATUO;
}
}
......
......@@ -44,6 +44,7 @@ static void Power_KL30_Init(void)
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();
......@@ -76,12 +77,14 @@ static void Power_KL30_Init(void)
static void Power_Wakeup_Init(void)
{
UART_Channel_Config_st_t loc_config;
Common_DataInit();
Gpio_Init(Gpio_WakeUp_Init);
eeprom_StoreInfo_Init();
Analog_Signal_Conv_Init();
Data_User_Mileage_WakeupInit();
Sys_WakeUp_Init();
RTE_CLOCK_Select_Start(); /* 由于休眠的时候时钟关闭,唤醒的时候打开时钟,才能进行下一步 */
Data_Vehicle_Speed_KL30_Wakeup_Init();
Data_Engine_Speed_KL30_Wakeup_Init();
LINE_IN_Init();
......@@ -89,6 +92,13 @@ static void Power_Wakeup_Init(void)
Line_In_KL15_ON_Init();
Fuel_KL30_Init();
Backlight_KL30_Wakeup_Init();
RTE_UART_Sleep_Init(UART_CH2);
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); /* 配置串口,630H上电发送0x0D,但是底板没回复 */
Amt630hInit();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 20000, 64000000);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
......@@ -124,8 +134,6 @@ static void Power_IG_ON_Init(void)
Fuel_KL15_Init();
//RTE_GPIO_Set_Level(Blacklight_PWM, 1);
FaultCode_Init();
Amt630hInit();
ResetInitedState();
}
static void Power_Sleep_Init(void)
......@@ -139,10 +147,11 @@ static void Power_Sleep_Init(void)
Gpio_Init(Gpio_Sleep_Init);
AMT630H_Sleep();
Analog_Signal_Conv_Stop();
if (RTE_GPIO_Get_Level(KL15_AD_IN) == 0)/* KL15 */
{
RTE_DEEPSLEEP_Enable();
}
RTE_UART_Sleep_Init(UART_CH2);
CGC_HSI_CFG_AS_FCLK(); /* 配置时钟生成控制器(cgc)以将内部高速振荡器(HSI)作为CPU系统时钟(FCLK)以及可能的其他硬件电路的时钟源。 */
//SystemCoreClockUpdate(); /* 更新时钟频率,暂时用不上,先注释 */
RTE_DEEPSLEEP_Enable();
// RTE_CLOCK_Select_Sleep(); /* 这边代码是开启时钟,暂时用不上,先注释 */
}
static Power_Status_em Power_Stay_ON(void)
......@@ -209,6 +218,7 @@ static Power_Status_em Power_Stay_Protect(void)
if ( SYS_OPR_STAT_RUN )
{
Amt630hInit();
//CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
return u8PowerSts;
}
......
......@@ -68,6 +68,7 @@ void UART_DeInit(SCIAFSelect_TypeDef UARTx)
CGC_PER0PeriphClockCmd(UARTx >> 10, DISABLE);
SCIChannel_Free(UARTx, UART_Mode_Rx | UART_Mode_Tx);
}
SCIChannel_Free(UARTx, UART_Mode_Rx | UART_Mode_Tx);
}
/**
......
......@@ -5,5 +5,6 @@
extern void RTE_CLOCK_Select_Start(void);
extern void RTE_CLOCK_Select_Stop(void);
extern void RTE_CLOCK_Select_Sleep(void);
#endif
......@@ -15,8 +15,8 @@ void RTE_CLOCK_Select_Start(void)
#ifdef USED_FX_FCLK
CGC_Osc_Setting(OSC_OSCILLATOR,OSC_UNDER_10M,OSC_OSCILLATOR,OSC_NORMAL_POWER);
CGC_PLL_Setting(PLL_SR_fMX,PLL_DIV_2,PLL_MUL_16);
CGC_PLL_CFG_AS_FCLK();
CGC_PLL_Setting(PLL_SR_fMX,PLL_DIV_2,PLL_MUL_16);/* CGC_PLL_Setting 用于配置PLL(相位锁定环)作为系统时钟以及可能的外设硬件电路的时钟源。 */
CGC_PLL_CFG_AS_FCLK(); /* PLL的输出频率配置为CPU系统时钟以及外设硬件电路的时钟源。 */
delay_init(64000000);
SystemCoreClock = 64000000UL;
#endif
......@@ -40,3 +40,20 @@ uint32_t RTE_CLOCK_Sys_Get(void)
}
void RTE_CLOCK_Select_Sleep(void)
{
uint8_t u8tempstabset1 = 0U;
uint8_t u8tempstabwait1 = 0U;
u8tempstabset1 = _FF_CGC_OSCSTAB_STA18;
do
{
u8tempstabwait1 = CGC->OSTC;
u8tempstabwait1 &= u8tempstabset1;
}
while (u8tempstabwait1 != u8tempstabset1);
CGC_PLL_Setting(PLL_SR_fMX,PLL_DIV_2,PLL_MUL_16);
CGC_PLL_CFG_AS_FCLK();//SRAM区运行
SystemCoreClock = 64000000UL;
}
......@@ -53,6 +53,7 @@ void Sys_20ms_Tasks(void)
void Sys_50ms_Tasks(void)
{
// BlueToothService();
BackLight_Service();
UpdateGraphics();
Telltales_Management();
g_u8Cursor_Posittion = Menu_Get_Current_Cursor_Information();
......
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