Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
hdw-mic.h
Go to the documentation of this file.
1
66#ifndef _HDW_MIC_H_
67#define _HDW_MIC_H_
68
69//==============================================================================
70// Includes
71//==============================================================================
72
73#include <stdint.h>
74
75#include <soc/gpio_num.h>
76
77//==============================================================================
78// Defines
79//==============================================================================
80
82#define ADC_READ_LEN 512
83
84#define MAX_MIC_GAIN 7
85
86#define ADC_SAMPLE_RATE_HZ 8000
87
88//==============================================================================
89// Function Prototypes
90//==============================================================================
91
92void initMic(gpio_num_t gpio);
93void startMic(void);
94uint32_t loopMic(uint16_t* outSamples, uint32_t outSamplesMax);
95void stopMic(void);
96void deinitMic(void);
97void powerDownMic(void);
98void powerUpMic(void);
99
100#endif
void deinitMic(void)
Deinitialize the ADC which continuously samples the microphone.
Definition hdw-mic.c:85
void initMic(gpio_num_t gpio)
Initialize the ADC which continuously samples the microphone.
Definition hdw-mic.c:26
uint32_t loopMic(uint16_t *outSamples, uint32_t outSamplesMax)
Attempt to read a block of 12-bit samples from the ADC in continuous mode. This may return fewer than...
Definition hdw-mic.c:131
void startMic(void)
Start sampling the microphone's ADC.
Definition hdw-mic.c:114
void powerUpMic(void)
Power up the ADC (microphone)
Definition hdw-mic.c:106
void stopMic(void)
Stop sampling the microphone's ADC.
Definition hdw-mic.c:161
void powerDownMic(void)
Power down the ADC (microphone)
Definition hdw-mic.c:98