Commit 0a4755cd authored by 时昊's avatar 时昊

🎉 init:删除无用代码-光线强度检测

parent 6b2301bf
This source diff could not be displayed because it is too large. You can view the blob instead.
/******************************************************************************
文 件 名:LightDetect.c
功能描述:光线强度检测驱动文件
作 者:刘庆宇
版 本:V1.0
日 期:2021.1.15
******************************************************************************/
#include "common.h"
#include "LightDetect.h"
#include "LtDet_ORAP_29044.h"
static uint16_t LightValue = 0;
/******************************************************************************
Function:Light_Detect_KL30_Init
Description:该服务函数首次KL30时调用一次
Input:
Output:
******************************************************************************/
void Light_Detect_KL30_Init(void)
{
}
/******************************************************************************
Function:Light_Detect_KL15_Init
Description:该服务函数首次KL15时调用一次
Input:
Output:
******************************************************************************/
void Light_Detect_KL15_Init(void)
{
ORAP_29044_Init();
LightValue = 1200;
}
/******************************************************************************
Function:Light_Detect_Serivce
Description:光线检测服务函数,放在100ms任务
Input:
Output:
******************************************************************************/
void Light_Detect_Serivce(void)
{
static uint8_t temp8 = 20;
if(temp8 == 0){
LightValue = Read_Light_value();
}
else{
temp8--;
}
}
uint16_t Get_Light_Value(void)
{
return LightValue;
}
#ifndef LIGHT_DETECT_H
#define LIGHT_DETECT_H
extern void Light_Detect_KL30_Init(void);
extern void Light_Detect_KL15_Init(void);
extern void Light_Detect_Serivce(void);
uint16_t Get_Light_Value(void);
#endif
#include "LtDet_ORAP_29044.h"
#include "LtDet_Simulated_IIC_Master.h"
#define ORAP_29044_DEVICE_ADDR 0x88u
void LtDet_i2c_write_one_byte(uint8_t DEVICE_ADDR,uint8_t REG_ADDR,uint8_t data)
{
LtDet_IIC_Delay();
LtDet_IIC_Start();
LtDet_IIC_Transmit_Data(DEVICE_ADDR);
LtDet_IIC_Transmit_Data(REG_ADDR);
LtDet_IIC_Transmit_Data(data);
LtDet_IIC_Stop();
}
uint8_t LtDet_i2c_read_one_byte(uint8_t DEVICE_ADDR,uint8_t REG_ADDR)
{
uint8_t data = 0u;
LtDet_IIC_Delay();
LtDet_IIC_Start();
LtDet_IIC_Transmit_Data(DEVICE_ADDR);
LtDet_IIC_Transmit_Data(REG_ADDR);
LtDet_IIC_Start();
LtDet_IIC_Transmit_Data(DEVICE_ADDR +1);
data = LtDet_IIC_Receive_Data();
LtDet_IIC_Transmit_ACK(IIC_ACK);
LtDet_IIC_Stop();
return data;
}
void ORAP_29044_Init(void)
{
LtDet_IIC_Init();
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x00);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x0F,0x29);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x0E,0x00);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x0F,0x00);
LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
}
uint16_t Read_Light_value(void)
{
uint16_t temp16;
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
// LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
temp16 = LtDet_i2c_read_one_byte(ORAP_29044_DEVICE_ADDR,0x0A);
LtDet_i2c_write_one_byte(ORAP_29044_DEVICE_ADDR,0x01,0x06);
temp16 <<= 8;
temp16 |= LtDet_i2c_read_one_byte(ORAP_29044_DEVICE_ADDR,0x09);
return temp16;
}
#ifndef _LTDET_ORAP29044_H_
#define _LTDET_ORAP29044_H_
#include "common.h"
extern void ORAP_29044_Init(void);
extern uint16_t Read_Light_value(void);
#endif
......@@ -29,7 +29,6 @@
#include "Flash_synchronizer.h"
#include "eepromManage.h"
#include "Data_Gear.h"
#include "LightDetect.h"
#include "BGLInterface.h"
#include "Key.h"
......
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