/*******************************************************************************
|
* File Name : TONE.c
|
* Description :
|
* Created on : 2022Äê4ÔÂ30ÈÕ
|
* Author : hido.ltd
|
*******************************************************************************/
|
|
/*******************************************************************************
|
* Include Files *
|
*******************************************************************************/
|
#include "TONE.h"
|
//#include "GPIO.h"
|
//#include "Delay.h"
|
#include "HIDO_Lock.h"
|
#include "HIDO_VLQueue.h"
|
#include "HIDO_Timer.h"
|
#include "string.h"
|
#include "HIDO_Util.h"
|
#include "global_param.h"
|
|
/*******************************************************************************
|
* Macro *
|
*******************************************************************************/
|
#define TONE_TEXT_QUEUE_CNT 4
|
|
/*******************************************************************************
|
* Type Definition *
|
*******************************************************************************/
|
|
/*******************************************************************************
|
* Local Variable *
|
*******************************************************************************/
|
static HIDO_UINT8 l_au8TONEQueueBuff[1024];
|
static HIDO_VLQStruct l_stTONEQueue;
|
|
/*******************************************************************************
|
* Local Function Declaration *
|
*******************************************************************************/
|
|
/*******************************************************************************
|
* Local Function *
|
*******************************************************************************/
|
|
/*******************************************************************************
|
* Global Function *
|
*******************************************************************************/
|
|
/*******************************************************************************
|
* Function Name : TONE_Play
|
* Description :
|
* Input :
|
* Output :
|
* Return :
|
* Author : hido.ltd
|
* Modified Date: : 2022Äê4ÔÂ30ÈÕ
|
*******************************************************************************/
|
HIDO_INT32 TONE_Play(HIDO_UINT8 *_pu8Data, HIDO_UINT32 _u32Len)
|
{
|
// GPIOD->BSRR = 0x0004; //´ò¿ªTONEµçÔ´
|
//// delay_ms(800); //±ØÒªÑÓʱ,ÑÓʱÊÇΪÁ˱ÜÃâ˵²»³öÀ´µÚÒ»¸ö×Ö£¬·äÃù¾Í²»ÓÃÑÓʱÁË
|
//
|
// if((0 == _u32Len) || (HIDO_NULL == _pu8Data))
|
// {
|
// return HIDO_ERR;
|
// }
|
|
// HIDO_VLQMemberStruct *pstMember = HIDO_VLQGetEnqueueMember(&l_stTONEQueue, _u32Len);
|
|
// if(HIDO_NULL == pstMember)
|
// {
|
// return HIDO_ERR;
|
// }
|
|
// memcpy(pstMember->m_pDataAddr, _pu8Data, _u32Len);
|
// HIDO_VLQEnqueue(&l_stTONEQueue, pstMember);
|
|
// return HIDO_OK;
|
}
|
|
/*******************************************************************************
|
* Function Name : TONE_GetNextData
|
* Description :
|
* Input :
|
* Output :
|
* Return :
|
* Author : hido.ltd
|
*******************************************************************************/
|
HIDO_VLQMemberStruct *TONE_GetNextData(HIDO_VOID)
|
{
|
return HIDO_VLQGetDequeueMember(&l_stTONEQueue);
|
}
|
|
/*******************************************************************************
|
* Function Name : TONE_ReleaseData
|
* Description :
|
* Input :
|
* Output :
|
* Return :
|
* Author : hido.ltd
|
*******************************************************************************/
|
HIDO_INT32 TONE_ReleaseData(HIDO_VLQMemberStruct *_pstData)
|
{
|
if(_pstData == TONE_GetNextData())
|
{
|
return HIDO_VLQDequeue(&l_stTONEQueue, _pstData);
|
}
|
|
return HIDO_OK;
|
}
|
|
/*******************************************************************************
|
* Function Name : TONE_Init
|
* Description :
|
* Input :
|
* Output :
|
* Return :
|
* Author : hido.ltd
|
*******************************************************************************/
|
HIDO_INT32 TONE_Init(HIDO_VOID)
|
{
|
HIDO_VLQInit(&l_stTONEQueue, l_au8TONEQueueBuff, sizeof(l_au8TONEQueueBuff), TONE_TEXT_QUEUE_CNT);
|
|
return HIDO_OK;
|
}
|