Added option to mic_test to allow sampling of the audio coming from RTX stage
This commit is contained in:
parent
63e68b642a
commit
c887a61599
|
|
@ -24,6 +24,12 @@
|
||||||
#include <interfaces/gpio.h>
|
#include <interfaces/gpio.h>
|
||||||
#include <hwconfig.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";
|
static const char hexdigits[]="0123456789abcdef";
|
||||||
void printUnsignedInt(uint16_t x)
|
void printUnsignedInt(uint16_t x)
|
||||||
{
|
{
|
||||||
|
|
@ -45,10 +51,15 @@ int main()
|
||||||
|
|
||||||
gpio_setMode(GREEN_LED, OUTPUT);
|
gpio_setMode(GREEN_LED, OUTPUT);
|
||||||
gpio_setMode(RED_LED, OUTPUT);
|
gpio_setMode(RED_LED, OUTPUT);
|
||||||
gpio_setMode(AIN_MIC, INPUT_ANALOG);
|
|
||||||
gpio_setMode(MIC_PWR, OUTPUT);
|
gpio_setMode(MIC_PWR, OUTPUT);
|
||||||
gpio_setPin(MIC_PWR);
|
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)
|
/* Enable pull-up resistor on PA3 (AIN_MIC)
|
||||||
GPIOA->PUPDR |= 1 << 6; */
|
GPIOA->PUPDR |= 1 << 6; */
|
||||||
|
|
||||||
|
|
@ -98,7 +109,12 @@ int main()
|
||||||
| ADC_SMPR2_SMP8;
|
| ADC_SMPR2_SMP8;
|
||||||
|
|
||||||
ADC1->SQR1 = 0; /* One channel to be converted */
|
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
|
* No overrun interrupt, 12-bit resolution, no analog watchdog, no
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue