aud_app.c

版权声明:本文仅为本人转载学习保存使用,并未用作其他任何之处。 https://blog.csdn.net/qq_14997637/article/details/84143633
#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();
}

猜你喜欢

转载自blog.csdn.net/qq_14997637/article/details/84143633