MCPcopy Create free account
hub / github.com/BruceDevices/firmware / _setup_codec_mic

Function _setup_codec_mic

boards/m5stack-sticks3/interface.cpp:270–299  ·  view source on GitHub ↗

** Function: _setup_codec_mic ** location: modules/others/mic.cpp ** Handles audio CODEC to enable/disable microphone **********************************************************************/

Source from the content-addressed store, hash-verified

268** Handles audio CODEC to enable/disable microphone
269**********************************************************************/
270void _setup_codec_mic(bool enable) {
271 // Set microfone pin for ADV
272 mic_bclk_pin = (gpio_num_t)17;
273
274 static constexpr const uint8_t enabled_bulk_data[] = {
275 2, 0x00, 0x80, // 0x00 RESET/ CSM POWER ON
276 2, 0x01, 0xBA, // 0x01 CLOCK_MANAGER/ MCLK=BCLK
277 2, 0x02, 0x18, // 0x02 CLOCK_MANAGER/ MULT_PRE=3
278 2, 0x0D, 0x01, // 0x0D SYSTEM/ Power up analog circuitry
279 2, 0x0E, 0x02, // 0x0E SYSTEM/ : Enable analog PGA, enable ADC modulator
280 2, 0x14, 0x10, // ES8311_ADC_REG14 : select Mic1p-Mic1n / PGA GAIN (minimum)
281 2, 0x17, 0xBF, // ES8311_ADC_REG17 : ADC_VOLUME 0xBF == +- 0 dB
282 2, 0x1C, 0x6A, // ES8311_ADC_REG1C : ADC Equalizer bypass, cancel DC offset in digital domain
283 0
284 };
285 static constexpr const uint8_t disabled_bulk_data[] = {
286 2,
287 0x0D,
288 0xFC, // 0x0D SYSTEM/ Power down analog circuitry
289 2,
290 0x0E,
291 0x6A, // 0x0E SYSTEM
292 2,
293 0x00,
294 0x00, // 0x00 RESET/ CSM POWER DOWN
295 0
296 };
297
298 i2c_bulk_write(&Wire1, ES8311_ADDR, enable ? enabled_bulk_data : disabled_bulk_data);
299}

Callers

nothing calls this directly

Calls 1

i2c_bulk_writeFunction · 0.85

Tested by

no test coverage detected