EFR32 Mighty Gecko 1 Software Documentation  efr32mg1-doc-5.1.2
mic.h
Go to the documentation of this file.
1 /***************************************************************************/
16 #ifndef __MIC_H_
17 #define __MIC_H_
18 
19 #include <stdbool.h>
20 #include <stdint.h>
21 #include <stdlib.h>
22 #include "mic_config.h"
23 
24 /***************************************************************************/
29 /***************************************************************************/
35 #define MIC_ADC_ACQ_TIME MIC_CONFIG_ADC_ACQ_TIME
36 #define MIC_ADC_CLOCK_FREQ MIC_CONFIG_ADC_CLOCK_FREQ
40 /***************************************************************************/
46 #define MIC_OK 0
50 /***************************************************************************/
56 uint32_t MIC_init ( uint32_t fs, uint16_t *sampleBuffer, size_t len );
57 void MIC_deInit ( void );
58 void MIC_start ( uint32_t nsamples );
59 bool MIC_isBusy ( void );
60 
61 float MIC_getSoundLevel ( float *var );
62 float MIC_getMean ( void );
63 uint16_t *MIC_getSampleBuffer( void );
64 
69 #endif /* __MIC_H_ */
uint16_t * MIC_getSampleBuffer(void)
Gets the sample buffer.
Definition: mic.c:253
bool MIC_isBusy(void)
Checks if the microphone is in use.
Definition: mic.c:336
void MIC_deInit(void)
Powers down the MEMS microphone stops the ADC and frees up the DMA channel.
Definition: mic.c:186
float MIC_getSoundLevel(float *var)
Calculates the sound level.
Definition: mic.c:294
float MIC_getMean(void)
Calculates the average value of the samples in the buffer.
Definition: mic.c:267
void MIC_start(uint32_t nSamples)
Starts taking samples using DMA from the microphone.
Definition: mic.c:214