Added option to mic_test to allow sampling of the audio coming from RTX stage

replace/398e8a0cb9770312b7d3cb2be3c8e9683a13cc31
Silvano Seva 2021-04-14 23:47:13 +02:00
rodzic 63e68b642a
commit c887a61599
1 zmienionych plików z 18 dodań i 2 usunięć

Wyświetl plik

@ -24,6 +24,12 @@
#include <interfaces/gpio.h>
#include <hwconfig.h>
/*
* Uncomment this directive to sample audio coming from RTX stage instead of the
* one from microphone.
*/
// #define SAMPLE_RTX_AUDIO
static const char hexdigits[]="0123456789abcdef";
void printUnsignedInt(uint16_t x)
{
@ -45,10 +51,15 @@ int main()
gpio_setMode(GREEN_LED, OUTPUT);
gpio_setMode(RED_LED, OUTPUT);
gpio_setMode(AIN_MIC, INPUT_ANALOG);
gpio_setMode(MIC_PWR, OUTPUT);
gpio_setPin(MIC_PWR);
#ifdef SAMPLE_RTX_AUDIO
gpio_setMode(GPIOC, 13, INPUT_ANALOG);
#else
gpio_setMode(AIN_MIC, INPUT_ANALOG);
#endif
/* Enable pull-up resistor on PA3 (AIN_MIC)
GPIOA->PUPDR |= 1 << 6; */
@ -98,7 +109,12 @@ int main()
| ADC_SMPR2_SMP8;
ADC1->SQR1 = 0; /* One channel to be converted */
ADC1->SQR3 = 3; /* CH3, vox level on PA3 */
#ifdef SAMPLE_RTX_AUDIO
ADC1->SQR3 = 13; /* CH13, audio from RTX on PC13 */
#else
ADC1->SQR3 = 3; /* CH3, vox level on PA3 */
#endif
/*
* No overrun interrupt, 12-bit resolution, no analog watchdog, no