initial commit
This commit is contained in:
7
hal/hal_irled/config.mk
Executable file
7
hal/hal_irled/config.mk
Executable file
@@ -0,0 +1,7 @@
|
||||
SRC += $(wildcard $(HAL_DIR)/hal_irled/*.c)
|
||||
CFLAGS += -I$(HAL_DIR)/hal_irled
|
||||
ifdef MOD_IRLED
|
||||
SRC += $(wildcard $(HAL_DIR)/hal_irled/$(MOD_IRLED)/*.c)
|
||||
else
|
||||
$(warning warning you sure no audio?)
|
||||
endif
|
||||
37
hal/hal_irled/hal_interface_irled.c
Executable file
37
hal/hal_irled/hal_interface_irled.c
Executable file
@@ -0,0 +1,37 @@
|
||||
#include "hal_interface_irled.h"
|
||||
#include "hlog.h"
|
||||
|
||||
#define TAG "TAG_HAL_IRLED"
|
||||
|
||||
static IRCUT_MODE irled_mode = IRCUT_UNKNOWN;
|
||||
|
||||
extern void hal_irled_open(IRCUT_MODE mode);
|
||||
|
||||
static void *hal_irled_mode_set(void *param){
|
||||
kpacket *packet = (kpacket *)param;
|
||||
atomic_inc(packet);
|
||||
IRCUT_MODE new_mode = *((IRCUT_MODE*)packet->box->payload);
|
||||
hlogd("%s set_mode:%d", __func__, new_mode);
|
||||
if (irled_mode != new_mode){
|
||||
irled_mode = new_mode;
|
||||
hal_irled_open(new_mode == IRCUT_DAY ? 0 : 1);
|
||||
}else{
|
||||
hlogd("%s same as old no need to set new mode:%d", __func__, new_mode);
|
||||
}
|
||||
atomic_dec(packet);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t hal_irled_init(){
|
||||
hlogi("%s ok", __func__);
|
||||
hal_sub(EVENT_HAL_DAYNIGHT, hal_irled_mode_set, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
uint32_t hal_irled_deinit(){
|
||||
hal_unsub(EVENT_HAL_DAYNIGHT, hal_irled_mode_set);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_INIT(PRI_AFTER_DRIVER, hal_irled_init);
|
||||
28
hal/hal_irled/hal_interface_irled.h
Executable file
28
hal/hal_irled/hal_interface_irled.h
Executable file
@@ -0,0 +1,28 @@
|
||||
#ifndef __HAL_IRLED_H__
|
||||
#define __HAL_IRLED_H__
|
||||
#include "hal.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// 数据类型定义
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
/*irled init interface define,should be implement if needed*/
|
||||
uint32_t hal_irled_init();
|
||||
|
||||
/*irled deinit interface define,should be implement if needed*/
|
||||
uint32_t hal_irled_deinit();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __HAL_IRLED_H__ */
|
||||
9
hal/hal_irled/t40/hal_interface_irled_t40.c
Executable file
9
hal/hal_irled/t40/hal_interface_irled_t40.c
Executable file
@@ -0,0 +1,9 @@
|
||||
#include "hal_product_config.h"
|
||||
#include "hal_interface_irled.h"
|
||||
#include "hal_interface_gpio.h"
|
||||
|
||||
|
||||
void hal_irled_open(bool open){
|
||||
hal_gpio_output(GPIO_IRLED, open);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user