Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
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);
97
98#endif
void deinitMic(void)
Deinitialize the ADC which continuously samples the microphone.
Definition hdw-mic.c:141
void initMic(gpio_num_t gpio)
Initialize the ADC which continuously samples the microphone.
Definition hdw-mic.c:25
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:100
void startMic(void)
Start sampling the microphone's ADC.
Definition hdw-mic.c:84
void stopMic(void)
Stop sampling the microphone's ADC.
Definition hdw-mic.c:130