Commit 21489b3d authored by 时昊's avatar 时昊

🎉 init:增加背光模块

parent 7a571ddf
#include "BackLight.h"
#include "common.h"
#include "bsp_BU27030.h"
#include "System_Monitor.h"
#define BACK_LIGHT_DAY 800
#define BACK_LIGHT_NIGHT 200
_Light g_Light;
void GUI_Light_Init(void)
{
g_Light.Light_Day = 0;
g_Light.Light_Night = 0;
}
void Gui_LightProc(void)
{
/*if(SYS_OPR_STAT_HALT)
{
return;
}
if (SYS_OPR_STAT_IGN_ON)
{
if(BU2703_Get_Data1() > 200)
{
g_Light.Light_Night = 0;
g_Light.Light_Day++;
if (g_Light.Light_Day >= 15)//ms
{
g_Light.Light_Day = 15;
}
else
{
}
}
else
{
g_Light.Light_Day = 0;
g_Light.Light_Night++;
if (g_Light.Light_Night >= 15)
{
g_Light.Light_Night = 15;
}
else
{
}
}
}
else
{
g_Light.Light_Day = 0;
g_Light.Light_Night = 0;
}*/
}
#ifndef _BACKLIGHT_H_
#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;
void GUI_Light_Init(void);
void Gui_LightProc(void);
#endif
......@@ -37,22 +37,12 @@ uint16_t g_sleepDelay = 0;
void Power_KL30_Init ( void )
{
Sys_KL30_Init();
// UART2_Init(115200);
// uart2_User_KL30_Init();
Telltales_Init();
Telltales_Init();
Fuel_KL30_Init();
BU98R10_Init();
Data_User_Mileage_KL30Init();
BU2703_Senser_Init();
GUI_Light_Init();
}
......@@ -189,23 +179,17 @@ void Power_Sleep_Init(void)
void Power_Wakeup_Init ( void )
{
//Clock_Init();
GPIO_Init(GPIO_WAKEUP_MODE);
Sys_Tick_Timer_Start();
Analog_Signal_Conv_Init();
Sys_WakeUp_Init();
Telltales_Init();
// UART2_Init(115200);
// uart2_User_KL30_Init();
Common_DataInit();
BU98R10_Init();
APP_CAN_Init();
Data_User_Mileage_WakeupInit();
BU2703_Senser_Init();
GUI_Light_Init();
}
......@@ -230,17 +214,15 @@ void Power_IG_ON_Init(void)
Common_DataInit();
Fuel_KL15_Init();
// PORT_SetBit(SOC_3V3_en);
TMB0_PWM_Pin33_Init();
DiagnosisInit_main();
U2_DiagnosisInit_main();
//uart2_User_KL15_Init();
APP_CAN_Init();
Common_Set_IG_Sts(COMMON_POWER_ON);
// UART2_Init(115200);
BU2703_Senser_Init();
GUI_Light_Init();
......
......@@ -16,17 +16,16 @@
函数声明
******************************************************************************/
extern void Simulated_IIC_2_Init(void);
extern void bsp_IIC_delay(uint32_t time);
extern void bsp_IIC_Start(void);
extern void bsp_IIC_Stop(void);
extern void bsp_IIC_NACK(void);
extern void bsp_IIC_ACK(void);
extern void bsp_IIC_SendByte(uint8_t Data);
extern uint8_t bsp_IIC_ReadByte(void);
extern uint8_t bsp_IIC_WaitAck(void);
extern uint8_t bsp_IIC_ReadByte(void);
extern uint8_t bsp_IIC_WaitAck(void);
extern void Simulated_Release_SCL(void);
extern void bsp_IIC_nop( void );
extern void bsp_IIC_nop( void );
......@@ -2,9 +2,6 @@
#include "common.h"
#include "IIC.h"
uint16_t IIC1_CheckSDA_Times = 0u;
uint16_t IIC1_NACK_Times = 0u;
#define BU2703_SLAVE_ADDR 0X38
#define BU2703_FITER_SIZE 10
......@@ -14,7 +11,6 @@ typedef struct
uint16_t data1buf[BU2703_FITER_SIZE];
uint8_t index1;
uint16_t data1;
}BU2703_Datas_Struct;
BU2703_Datas_Struct BU2703Dat;
......@@ -30,7 +26,6 @@ uint8_t Register_BU2703_Senser[] =
void LIGHT_IIC_Write_Data(uint8_t devAddr, uint8_t len, uint8_t *Data)
{
uint8_t Ack = 0;
bsp_IIC_Start( );
bsp_IIC_SendByte(devAddr*2);
......@@ -54,14 +49,11 @@ void LIGHT_IIC_Write_Data(uint8_t devAddr, uint8_t len, uint8_t *Data)
bsp_IIC_Stop( );
}
void BU2703_Senser_Init(void )
{
uint8_t mAddr = 0XFF;
uint16_t i = 0;
mAddr = 0X38;
Simulated_IIC_2_Init();
for ( i = 0; i < 4; i++)
......@@ -70,11 +62,9 @@ void BU2703_Senser_Init(void )
}
}
uint8_t LIGHT_IIC_Read_Byte(uint8_t devAddr, uint8_t addr2, uint8_t *pData)
{
uint8_t Ack = 0;
bsp_IIC_Start( );
bsp_IIC_SendByte(devAddr * 2);
......@@ -111,7 +101,6 @@ uint8_t LIGHT_IIC_Read_Byte(uint8_t devAddr, uint8_t addr2, uint8_t *pData)
return 1;
}
void BU2703_Read_Datas(void )
{
uint8_t dataL = 0;
......@@ -142,7 +131,6 @@ void BU2703_Read_Datas(void )
BU2703Dat.index1++;
}
}
}
uint16_t BU2703_Get_Data1(void )
......@@ -150,7 +138,6 @@ uint16_t BU2703_Get_Data1(void )
return BU2703Dat.data1;
}
void App_SwapWord_u16(uint16_t *pData1,uint16_t *pData2)
{
uint16_t psw;
......@@ -162,8 +149,6 @@ void App_SwapWord_u16(uint16_t *pData1,uint16_t *pData2)
}
}
void App_SortNWord_u16(uint16_t *SortData,uint8_t len)
{
uint8_t n=0,m;
......
......@@ -54,31 +54,16 @@ void Sys_Startup_Pre_Init(void)
void Sys_Startup_Init(void)
{
Clock_Init();
GPIO_Init(GPIO_WAKEUP_MODE);
Sys_Tick_Timer_Start();
// /*COM_CAN_Init(); 原CAN初始化位置*/
//
Analog_Signal_Conv_Init();
// UART2_Init(115200);
RTC_Init(RTC_FSUB);
// /*30电数据初始化*/
Power_Management_Lib_Init();
Power_Management_Init(0u);
bsp_CAN_Init();
eeprom_StoreInfo_Init( ); //20221028
eeprom_StoreInfo_Init( );
}
/**************************************************************************//**
......
......@@ -141,6 +141,7 @@ void Sys_Run_Mode_100ms_Tasks_Group2(void)
void Sys_Run_Mode_100ms_Tasks_Group3(void)
{
BU2703_Read_Datas();
Gui_LightProc();
}
void Sys_Run_Mode_100ms_Tasks_Group4(void)
......
......@@ -1184,6 +1184,30 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>79</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\source\Application\Line\BackLight.c</PathWithFileName>
<FilenameWithoutPath>BackLight.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>80</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\source\Application\Line\BackLight.h</PathWithFileName>
<FilenameWithoutPath>BackLight.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
......@@ -1194,7 +1218,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>79</FileNumber>
<FileNumber>81</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1206,7 +1230,7 @@
</File>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>80</FileNumber>
<FileNumber>82</FileNumber>
<FileType>4</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1226,7 +1250,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>81</FileNumber>
<FileNumber>83</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1238,7 +1262,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>82</FileNumber>
<FileNumber>84</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1250,7 +1274,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>83</FileNumber>
<FileNumber>85</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1262,7 +1286,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>84</FileNumber>
<FileNumber>86</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1274,7 +1298,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>85</FileNumber>
<FileNumber>87</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1286,7 +1310,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>86</FileNumber>
<FileNumber>88</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1298,7 +1322,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>87</FileNumber>
<FileNumber>89</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1310,7 +1334,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>88</FileNumber>
<FileNumber>90</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1322,7 +1346,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>89</FileNumber>
<FileNumber>91</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1334,7 +1358,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>90</FileNumber>
<FileNumber>92</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1346,7 +1370,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>91</FileNumber>
<FileNumber>93</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1366,7 +1390,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>92</FileNumber>
<FileNumber>94</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1378,7 +1402,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>93</FileNumber>
<FileNumber>95</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1390,7 +1414,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>94</FileNumber>
<FileNumber>96</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1402,7 +1426,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>95</FileNumber>
<FileNumber>97</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1414,7 +1438,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>96</FileNumber>
<FileNumber>98</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1426,7 +1450,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>97</FileNumber>
<FileNumber>99</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1438,7 +1462,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>98</FileNumber>
<FileNumber>100</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1450,7 +1474,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>99</FileNumber>
<FileNumber>101</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1462,7 +1486,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>100</FileNumber>
<FileNumber>102</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......@@ -1474,7 +1498,7 @@
</File>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>101</FileNumber>
<FileNumber>103</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
......
......@@ -783,6 +783,16 @@
<FileType>5</FileType>
<FilePath>.\source\Application\Mileage\Services_Mileage_User.h</FilePath>
</File>
<File>
<FileName>BackLight.c</FileName>
<FileType>1</FileType>
<FilePath>.\source\Application\Line\BackLight.c</FilePath>
</File>
<File>
<FileName>BackLight.h</FileName>
<FileType>5</FileType>
<FilePath>.\source\Application\Line\BackLight.h</FilePath>
</File>
</Files>
</Group>
<Group>
......
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