mirror of
https://github.com/DualTachyon/uv-k5-firmware.git
synced 2024-11-27 08:59:52 +08:00
Added AUDIO_PlayVoice.
This commit is contained in:
parent
757968759e
commit
92506bcfff
1
Makefile
1
Makefile
@ -33,6 +33,7 @@ OBJS += driver/systick.o
|
||||
OBJS += driver/uart.o
|
||||
|
||||
# Main
|
||||
OBJS += audio.o
|
||||
OBJS += battery.o
|
||||
OBJS += board.o
|
||||
OBJS += dcs.o
|
||||
|
27
audio.c
Normal file
27
audio.c
Normal file
@ -0,0 +1,27 @@
|
||||
#include "audio.h"
|
||||
#include "bsp/dp32g030/gpio.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/system.h"
|
||||
#include "driver/systick.h"
|
||||
|
||||
void AUDIO_PlayVoice(uint8_t VoiceID)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
SYSTEM_DelayMs(7);
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((VoiceID & 0x80U) == 0) {
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_1);
|
||||
} else {
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_VOICE_1);
|
||||
}
|
||||
SYSTICK_DelayUs(1200);
|
||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
SYSTICK_DelayUs(1200);
|
||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_VOICE_0);
|
||||
VoiceID <<= 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user