From: p15692025051 <846603105@qq.com> Date: Wed, 22 Oct 2025 04:18:39 +0000 (+0800) Subject: 左右摇头代码 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=6a83b5a43b2108b6c62f7f8cda951cf65df7a2e4;p=mirrors%2FFX01.git 左右摇头代码 --- diff --git a/2.code/aicos/app/AI_AMP_2_5/mot_dev.c b/2.code/aicos/app/AI_AMP_2_5/mot_dev.c index db1009a..4fe4896 100644 --- a/2.code/aicos/app/AI_AMP_2_5/mot_dev.c +++ b/2.code/aicos/app/AI_AMP_2_5/mot_dev.c @@ -30,11 +30,25 @@ #include "efuse.h" #include "gpo_inc.h" #include "mot_dev.h" -#define MOT_EN_FWD_IO GPO_2 //马达驱动正反转,20脚 GPO2 -#define MOT_EN_REV_IO GPIO_14 //马达驱动正反转,74脚 GPIO_14 -#define MOT_TOP_SITE_IO GPIO_1 //马达转到最上位置io,56脚 -#define MOT_MIDDLE_SITE_IO GPIO_0 //马达转到最中位置io,77脚 -#define MOT_BOOTOM_SITE_IO GPIO_7//马达转到最下位置io ,81脚 +// #define MOT_EN_FWD_IO GPO_2 //马达驱动正反转,20脚 GPO2 +// #define MOT_EN_REV_IO GPIO_14 //马达驱动正反转,74脚 GPIO_14 +// #define MOT_TOP_SITE_IO GPIO_1 //马达转到最上位置io,56脚 +// #define MOT_MIDDLE_SITE_IO GPIO_26 //马达转到最中位置io,77脚 +// #define MOT_BOOTOM_SITE_IO GPIO_7//马达转到最下位置io ,81脚 + + +// #define MOT_EN_LR_FWD_IO GPO_13 //马达驱动正反转,79脚 GPO2 +// #define MOT_EN_LR_REV_IO GPIO_19 //马达驱动正反转,75脚 GPIO_14 +// #define MOT_LR_TOP_SITE_IO GPIO_18 //马达转到最上位置io,85脚 +// #define MOT_LR_MIDDLE_SITE_IO GPIO_26 //马达转到最中位置io,86脚 +// #define MOT_LR_BOOTOM_SITE_IO GPIO_6//马达转到最下位置io ,80脚 + +#define MOT_EN_FWD_IO GPO_13 //马达驱动正反转,20脚 GPO2 +#define MOT_EN_REV_IO GPIO_19 //马达驱动正反转,74脚 GPIO_14 +#define MOT_TOP_SITE_IO GPIO_18 //马达转到最左位置io,85脚 +#define MOT_BOOTOM_SITE_IO GPIO_26 //马达转到最中左右位置io,86脚 +#define MOT_MIDDLE_SITE_IO GPIO_6//马达转到最中位置io ,81脚 + static unsigned char mot_nod_count = 0;//点头次数 static unsigned char mot_nod_state = 0;//当前点头方向,0向下,1向上 static unsigned char mot_MIDDLE_flag = 0;//判断当前有没有回正 @@ -172,7 +186,16 @@ static void mot_dev_task(void *thread_input)//马达线程 mot_dev_MSG_queue_t mot_dev_msg = {0}; - + // while(1) + // { + + // //mot_test(); + + // bk_printf("å·¦:%d",aic_gpio_level_get(MOT_TOP_SITE_IO)); + // bk_printf("中:%d",aic_gpio_level_get(MOT_MIDDLE_SITE_IO)); + // bk_printf("右:%d",aic_gpio_level_get(MOT_BOOTOM_SITE_IO)); + // aos_sleep(1000); + // } while (1) { if(mot_dev_task_queue) { @@ -215,12 +238,9 @@ void mot_init(void) // aic_gpo_output( GPO_2,GPO_OUTPUT_LOW );//马达 // aic_gpio_output(GPIO_14,GPIO_OUTPUT_LVL_LOW );//马达 bk_printf("mot_init:22!!!!"); - // aic_gpio_input(MOT_TOP_SITE_IO, GPIO_TRIGGER_EDGE_FALLING, - // mot_gpio_handle, "TOP"); - // aic_gpio_input(MOT_MIDDLE_SITE_IO, GPIO_TRIGGER_EDGE_FALLING, - // mot_gpio_handle, "MIDDLE"); - // aic_gpio_input(MOT_BOOTOM_SITE_IO, GPIO_TRIGGER_EDGE_FALLING, - // mot_gpio_handle, "BOOTOM"); + aic_gpio_input(MOT_TOP_SITE_IO, GPIO_INPUT_NOINT, NULL, NULL); + aic_gpio_input(MOT_MIDDLE_SITE_IO, GPIO_INPUT_NOINT, NULL, NULL); + aic_gpio_input(MOT_BOOTOM_SITE_IO, GPIO_INPUT_NOINT, NULL, NULL); //创建mot_dev_task队列 if(mot_dev_task_queue == NULL) { @@ -265,22 +285,25 @@ void MTO_restert(void) bk_printf("MTO_restert:中间IO:%d",aic_gpio_level_get(MOT_MIDDLE_SITE_IO)); bk_printf("MTO_restert:底部IO:%d",aic_gpio_level_get(MOT_BOOTOM_SITE_IO)); bk_printf("MTO_restert:顶部IO:%d",aic_gpio_level_get(MOT_TOP_SITE_IO)); - if(aic_gpio_level_get(MOT_BOOTOM_SITE_IO) == 0)//到低部 - { - head_up();//抬头 - bk_printf("MTO_restert:向上归位"); + // if(aic_gpio_level_get(MOT_BOOTOM_SITE_IO) == 0)//到低部 + // { + // head_up();//抬头 + // bk_printf("MTO_restert:向上归位"); - }else if(aic_gpio_level_get(MOT_TOP_SITE_IO) == 0)//到顶部 - { - bk_printf("MTO_restert:向下归位"); - head_drop();//低头 - }else//已经到中间了 - { - bk_printf("MTO_restert:已经到中间"); - aic_gpo_output(MOT_EN_FWD_IO,GPO_OUTPUT_LOW );//马达 - aic_gpio_output(MOT_EN_REV_IO,GPIO_OUTPUT_LVL_LOW );//马达 - return; - } + // }else if(aic_gpio_level_get(MOT_TOP_SITE_IO) == 0)//到顶部 + // { + // bk_printf("MTO_restert:向下归位"); + // head_drop();//低头 + // }else if(aic_gpio_level_get(MOT_MIDDLE_SITE_IO) == 0)//已经到中间了 + // { + // bk_printf("MTO_restert:已经到中间"); + // aic_gpo_output(MOT_EN_FWD_IO,GPO_OUTPUT_LOW );//马达 + // aic_gpio_output(MOT_EN_REV_IO,GPIO_OUTPUT_LVL_LOW );//马达 + // return; + // }else + // { + // head_drop();//低头 + // } int count = 10000; while (count--) { @@ -289,6 +312,16 @@ void MTO_restert(void) // bk_printf("MTO_restert:顶部IO:%d",aic_gpio_level_get(MOT_TOP_SITE_IO)); if(aic_gpio_level_get(MOT_MIDDLE_SITE_IO) == 0) break; + else if(aic_gpio_level_get(MOT_BOOTOM_SITE_IO) == 0)//到低部 + { + head_up();//抬头 + bk_printf("MTO_restert:向上归位"); + + }else if(aic_gpio_level_get(MOT_TOP_SITE_IO) == 0)//到顶部 + { + bk_printf("MTO_restert:向下归位"); + head_drop();//低头 + } aos_sleep(1); } aos_sleep(50); diff --git a/2.code/aicos/drivers/sound/driver/codec/es8311.c b/2.code/aicos/drivers/sound/driver/codec/es8311.c index f1ac627..2d2dd90 100644 --- a/2.code/aicos/drivers/sound/driver/codec/es8311.c +++ b/2.code/aicos/drivers/sound/driver/codec/es8311.c @@ -18,7 +18,7 @@ /* Auto gen by tool, don't change it. */ #define AIC_THIS_FILE 0x091cd4 #define LOG_MODULE AMOD_SOUND -#define BK_CODEC 1 +#define BK_CODEC 0 #include #include #include @@ -606,7 +606,7 @@ static void es8311_ext_power(BOOL on) if (!es8311_data->ext_power_on) { pmu_enable(es8311_data->power); #if BK_CODEC ==1 - aic_gpio_output(GPIO_GPO_13,GPIO_OUTPUT_LVL_HIGH ); + //aic_gpio_output(GPIO_GPO_13,GPIO_OUTPUT_LVL_HIGH ); #endif es8311_data->ext_power_on = TRUE; printk("ext power on\n"); @@ -615,7 +615,7 @@ static void es8311_ext_power(BOOL on) } else { if (es8311_data->ext_power_on) { #if BK_CODEC ==1 - aic_gpio_output(GPIO_GPO_13,GPIO_OUTPUT_LVL_LOW); + //aic_gpio_output(GPIO_GPO_13,GPIO_OUTPUT_LVL_LOW); #endif pmu_disable(es8311_data->power); es8311_data->ext_power_on = FALSE; @@ -1004,7 +1004,7 @@ static int amic_event(struct snd_dpm_widget *w, case SND_DPM_PRE_PMU: pmu_enable(es8311->vmicbias); #if BK_CODEC ==1 - aic_gpio_output(GPIO_GPO_13,GPIO_OUTPUT_LVL_HIGH ); + //aic_gpio_output(GPIO_GPO_13,GPIO_OUTPUT_LVL_HIGH ); #endif printk("amic vmicbias on!\n"); if (es8311->is_low_domain) @@ -1315,7 +1315,7 @@ static int es8311_i2c_probe(void) if (es8311->power) pmu_enable(es8311->power); #if BK_CODEC ==1 - aic_gpio_output(GPIO_GPO_13,GPIO_OUTPUT_LVL_HIGH ); + //aic_gpio_output(GPIO_GPO_13,GPIO_OUTPUT_LVL_HIGH ); #endif i2c_init(&es8311->client); bk_printf("es8311_i2c_probe:es8311->client=%d",es8311->client.index);