Code: Select all
void start_sine_tone() {
dac_i2s_disable();
dac_cw_config_t cw_config = {
.en_ch = AUDIO_OUT_PIN,
.scale = DAC_CW_SCALE_4, //quietest is 8, loudest is 1
.phase = DAC_CW_PHASE_0, //other option is DAC_CW_PHASE_180
.freq = 500, //Results in a tone of around 390 Hz??
.offset = 64 //rather strange that by default this parameter expects a range of -128 to 127, but the dac_output_voltage function expects 0 to 255 if I'm not mistaken?
};
// Configure DAC continuous wave generator
dac_cw_generator_config(&cw_config);
// Enable DAC continuous wave generator
dac_cw_generator_enable();
}
EDIT: I am using ESP-IDF v4.4.4