WXK
2025-03-25 4a0afa1557e0189d8d32cc59f7a246f5188bb8e6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*******************************************************************************
 * 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;
}