Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
Loading...
Searching...
No Matches
hdw-mic.c File Reference

Functions

void initMic (gpio_num_t gpio)
 Initialize the ADC which continuously samples the microphone.
 
void startMic (void)
 Start sampling the microphone's ADC.
 
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 expected samples (or zero samples) if the task rate is faster than the sampling rate.
 
void stopMic (void)
 Stop sampling the microphone's ADC.
 
void deinitMic (void)
 Deinitialize the ADC which continuously samples the microphone.
 

Function Documentation

◆ initMic()

void initMic ( gpio_num_t gpio)

Initialize the ADC which continuously samples the microphone.

This does not start sampling, so startMic() must be called afterwards.

Parameters
gpioThe GPIO the microphone is attached to

◆ startMic()

void startMic ( void )

Start sampling the microphone's ADC.

◆ loopMic()

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 expected samples (or zero samples) if the task rate is faster than the sampling rate.

Parameters
[out]outSamplesA pointer to write 12-bit samples from the ADC
[in]outSamplesMaxThe maximum number of samples that can be written to outSamples
Returns
The number of samples which were actually written to outSamples

◆ stopMic()

void stopMic ( void )

Stop sampling the microphone's ADC.

◆ deinitMic()

void deinitMic ( void )

Deinitialize the ADC which continuously samples the microphone.