mirror of
https://github.com/DualTachyon/uv-k5-firmware.git
synced 2025-02-17 17:50:43 +08:00
Added DTMF_FindContact.
This commit is contained in:
parent
db2e9686ea
commit
2e28b98e51
26
dtmf.c
26
dtmf.c
@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "driver/eeprom.h"
|
||||
#include "dtmf.h"
|
||||
|
||||
@ -50,3 +51,28 @@ bool DTMF_GetContact(uint8_t Index, char *pContact)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DTMF_FindContact(const char *pContact, char *pResult)
|
||||
{
|
||||
char Contact [16];
|
||||
uint8_t i, j;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (!DTMF_GetContact(i, Contact)) {
|
||||
return false;
|
||||
}
|
||||
for (j = 0; j < 3; j++) {
|
||||
if (pContact[j] != Contact[j + 8]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == 3) {
|
||||
memcpy(pResult, Contact, 8);
|
||||
pResult[8] = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user