aud_app.c

#include "aud_app.h"
#include "aud_common.h"
#include "aud_usr.h"


static sci_ESequence g_sci_ESequence = sci_seqVoid;
/*开功放*/
static void aud_amp_poweron(void)
{
#if _AUD_DEBUG
    AUD_TRACE("aud_amp_poweron \r\n");
#endif
    pfv_OutputHigh(AUD_AMR_POWIO);
}

/*关功放*/
static void aud_amp_poweroff(void)
{
#if _AUD_DEBUG
    AUD_TRACE("aud_amp_poweroff \r\n");
#endif
    pfv_OutputLow(AUD_AMR_POWIO);
}


static BOOL aud_app_init(sci_ESequence vp_sciSeq)
{
/*配置功放引脚*/
	pfv_SetGpioMode(base_IO_GPIO4, base_GPIO_MODE_OUT_PULL, base_PORT_LEVEL_HIGH);

/*打开串口*/
	sci_SConfig sci_cfg = { 0 };
	sci_cfg.v_Baudrate = 921600;
	sci_cfg.v_DataBits = 8;
	sci_cfg.v_FlowCtrl = sci_flowControlNo;
	sci_cfg.v_Parity = sci_parityNo;
	sci_cfg.v_StopBits = sci_stopBitOne;
	if (pfv_sci_Open(vp_sciSeq, &sci_cfg) == FALSE)
	{
		AUD_TRACE("sci_seq[%d] init failed! \r\n", sci_seqThird);
		g_sci_ESequence = vp_sciSeq;
		return FALSE;
	}
	return TRUE;
}


static BOOL aud_app_uninit(void)
{
	return pfv_sci_Close(g_sci_ESequence);
}



/*打开音频应用*/
s32 start_audio_app(sci_ESequence vp_sciSeq, const void * pp_ptr, u32 vp_ulen)
{
	BOOL ret = FALSE;
	ret = aud_app_init(vp_sciSeq);
	if (ret)
	{
		aud_amp_poweron();
		return usr_aud_do(pp_ptr, vp_ulen);
	}
	else
	{
		return -1;
	}
}


/*关闭音频应用*/
BOOL close_audio_app(void)
{
	aud_amp_poweron();
	return aud_app_uninit();
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值