|
EFR32 Blue Gecko 1 Software Documentation
efr32bg1-doc-5.1.2
|
MEMS microphone driver and support functions.
DO_NOT_INCLUDE_WITH_DOXYGEN
Functions | |
| void | MIC_deInit (void) |
| Powers down the MEMS microphone stops the ADC and frees up the DMA channel. More... | |
| float | MIC_getMean (void) |
| Calculates the average value of the samples in the buffer. More... | |
| uint16_t * | MIC_getSampleBuffer (void) |
| Gets the sample buffer. More... | |
| float | MIC_getSoundLevel (float *var) |
| Calculates the sound level. More... | |
| uint32_t | MIC_init (uint32_t fs, uint16_t *buffer, size_t len) |
| Initializes MEMS microphone and sets up the DMA, ADC and clocking. More... | |
| bool | MIC_isBusy (void) |
| Checks if the microphone is in use. More... | |
| void | MIC_start (uint32_t nSamples) |
| Starts taking samples using DMA from the microphone. More... | |
| void MIC_deInit | ( | void | ) |
Powers down the MEMS microphone stops the ADC and frees up the DMA channel.
Definition at line 186 of file mic.c.
References BOARD_micEnable(), DMADRV_FreeChannel(), and PRS_SourceAsyncSignalSet().
| float MIC_getMean | ( | void | ) |
Calculates the average value of the samples in the buffer.
Definition at line 267 of file mic.c.
Referenced by MIC_getSoundLevel().
| uint16_t * MIC_getSampleBuffer | ( | void | ) |
| float MIC_getSoundLevel | ( | float * | var | ) |
Calculates the sound level.
| [out] | var | The variance of the samples |
Definition at line 294 of file mic.c.
References MIC_getMean().
| uint32_t MIC_init | ( | uint32_t | fs, |
| uint16_t * | buffer, | ||
| size_t | len | ||
| ) |
Initializes MEMS microphone and sets up the DMA, ADC and clocking.
DO_NOT_INCLUDE_WITH_DOXYGEN
| [in] | fs | The desired sample rate in Hz |
| [in] | buffer | Pointer to the sample buffer to store the ADC data |
| [in] | len | The size of the sample buffer |
Definition at line 87 of file mic.c.
References ADC0, ADC_Init(), ADC_INIT_DEFAULT, ADC_InitScan(), ADC_INITSCAN_DEFAULT, ADC_PrescaleCalc(), ADC_ScanInputClear(), ADC_ScanSingleEndedInputAdd(), ADC_TimebaseCalc(), adcInit(), adcRef2V5, BOARD_micEnable(), CMU, CMU_ADCCTRL_ADC0CLKSEL_AUXHFRCO, CMU_ClockEnable(), CMU_ClockFreqGet(), CMU_ClockSelectSet(), CMU_CTRL_CLKOUTSEL1_LFXOQ, CMU_CTRL_CLKOUTSEL1_ULFRCOQ, cmuClock_ADC0, cmuClock_AUX, cmuClock_LFA, cmuClock_PRS, cmuSelect_LFXO, LETIMER_Init_TypeDef::comp0Top, DMADRV_AllocateChannel(), DMADRV_Init(), ECODE_EMDRV_DMADRV_OK, ADC_Init_TypeDef::em2ClockConfig, LETIMER_Init_TypeDef::enable, LETIMER_CompareSet(), LETIMER_Init(), LETIMER_INIT_DEFAULT, LETIMER_RepeatSet(), letimerUFOAPulse, MIC_ADC_CLOCK_FREQ, ADC_Init_TypeDef::prescale, PRS_SourceAsyncSignalSet(), ADC_InitScan_TypeDef::prsEnable, ADC_InitScan_TypeDef::prsSel, ADC_InitScan_TypeDef::reference, ADC_InitScan_TypeDef::scanDmaEm2Wu, ADC_Init_TypeDef::timebase, and LETIMER_Init_TypeDef::ufoa0.
| bool MIC_isBusy | ( | void | ) |
| void MIC_start | ( | uint32_t | nSamples | ) |
Starts taking samples using DMA from the microphone.
| [in] | nSamples | The number of the samples to take |
Definition at line 214 of file mic.c.
References ADC0, DMADRV_PeripheralMemory(), dmadrvDataSize2, and dmadrvPeripheralSignal_ADC0_SCAN.