initial commit

This commit is contained in:
2025-08-05 15:53:44 +08:00
commit 09dc02ae52
553 changed files with 137665 additions and 0 deletions

7
hal/hal_ircut/config.mk Executable file
View File

@@ -0,0 +1,7 @@
SRC += $(wildcard $(HAL_DIR)/hal_ircut/*.c)
CFLAGS += -I$(HAL_DIR)/hal_ircut
ifdef MOD_IRCUT
SRC += $(wildcard $(HAL_DIR)/hal_ircut/$(MOD_IRCUT)/*.c)
else
$(warning warning you sure no ircut?)
endif

View File

@@ -0,0 +1,41 @@
#include "hal_interface_ircut.h"
#include "hlog.h"
#define TAG "TAG_HAL_IRCUT"
static IRCUT_MODE ircut_mode = IRCUT_UNKNOWN;
extern void hal_ircut_switch(IRCUT_MODE mode);
static void *hal_ircut_mode_set(void *param){
kpacket *packet = (kpacket*)param;
IRCUT_MODE new_mode = *((IRCUT_MODE*)packet->box->payload);
hlogd("%s set_mode:%d", __func__, new_mode);
if (ircut_mode != new_mode){
ircut_mode = new_mode;
hal_ircut_switch(new_mode);
}else{
hlogd("%s same as old no need to set new mode:%d", __func__, new_mode);
}
return 0;
}
uint32_t hal_ircut_init(){
hlogi("%s ok", __func__);
hal_sub(EVENT_HAL_DAYNIGHT, hal_ircut_mode_set, NULL);
return 0;
}
uint32_t hal_ircut_deinit(){
hal_unsub(EVENT_HAL_DAYNIGHT, hal_ircut_mode_set);
return 0;
}
IRCUT_MODE hal_ircut_mode_get(){
return ircut_mode;
}
DECLARE_INIT(PRI_AFTER_DRIVER, hal_ircut_init);

View File

@@ -0,0 +1,34 @@
#ifndef __HAL_IRCUT_H__
#define __HAL_IRCUT_H__
#include "hal.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
////////////////////////////////////////////////////////////
//
// 数据类型定义
//
////////////////////////////////////////////////////////////
/*ircut init interface define,should be implement if needed*/
uint32_t hal_ircut_init();
/*ircut deinit interface define,should be implement if needed*/
uint32_t hal_ircut_deinit();
/*ircut get mode interface define,must be implement*/
IRCUT_MODE hal_ircut_mode_get();
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __HAL_IRCUT_H__ */

View File

@@ -0,0 +1,18 @@
#include "hal_product_config.h"
#include "hal_interface_ircut.h"
#include "hal_interface_gpio.h"
#include "mmc.h"
#include "hlog.h"
void hal_ircut_switch(IRCUT_MODE mode){
if (mode != IRCUT_UNKNOWN){
hal_gpio_output(GPIO_IRCUT_ENB, mode == IRCUT_DAY);
hal_gpio_output(GPIO_IRCUT_FBC, mode != IRCUT_DAY);
hv_msleep(150);
hal_gpio_output(GPIO_IRCUT_ENB,0);
hal_gpio_output(GPIO_IRCUT_FBC,0);
}
}