Commit 579e0ae3 authored by 郑萍's avatar 郑萍

🎉 init:删除光感模块

parent 4dacfeaa
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -608,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>
......
......@@ -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);
......
......@@ -20,8 +20,8 @@
#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 "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,11 +49,9 @@ static void Power_KL30_Init(void)
DFlash_init();
Analog_Signal_Conv_Init();
BU98R10_Init();
BackLight_Init();
Sys_KL30_Init();
Checkself_Init();
LINE_IN_Init();
Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example();//注意顺序2
Data_User_Mileage_KL30Init();
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
......@@ -84,12 +82,9 @@ static void Power_Wakeup_Init(void)
Analog_Signal_Conv_Init();
Data_User_Mileage_WakeupInit();
BU98R10_Init();
BackLight_Init();
Sys_WakeUp_Init();
LINE_IN_Init();
Line_In_KL15_ON_Init();
Light_Sensor_Init_Example();//注意顺序1
LED_Driver_Init_Example();//注意顺序2
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER0, 400, 64000000);
TimerM_PWM_counter_Output_Init(TIMERM_COUNTER1, 400, 64000000);
TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHB, ActiveLevel_High);
......@@ -117,7 +112,6 @@ 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();
......
......@@ -82,7 +82,7 @@ void Sys_100ms_Tasks(void)
u8LEDDriverCheckCount = 0U;
LED_Driver_Work_Check();
LED_Driver_Service_Immediate();//注意顺序1
ALS_Service();//注意顺序2
}
else
{
......
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