Skip to content

Commit

Permalink
AnalogDriverESP32V1 end()
Browse files Browse the repository at this point in the history
  • Loading branch information
pschatzmann committed Nov 20, 2024
1 parent f748f0a commit 5d41c41
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions src/AudioTools/CoreAudio/AudioAnalog/AnalogDriverESP32V1.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
/// Start the Analog driver
/// ----------------------------------------------------------
bool begin(AnalogConfigESP32V1 cfg) {
// TRACEI();
TRACEI();
bool result = true;
this->cfg = cfg;

Expand Down Expand Up @@ -68,12 +68,10 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
/// Stop and uninstalls the driver
/// ----------------------------------------------------------
void end() override {
// TRACEI();
#ifdef HAS_ESP32_DAC
TRACEI();
if (active_tx) {
dac_continuous_del_channels(dac_handle);
cleanup_tx();
}
#endif
if (active_rx) {
cleanup_rx();
}
Expand Down Expand Up @@ -612,8 +610,23 @@ class AnalogDriverESP32V1 : public AnalogDriverBase {
return true;
}

// Cleanup Analog to Digital Converter
// ----------------------------------------------------------
/// Cleanup dac
bool cleanup_tx() {
bool ok = true;
#ifdef HAS_ESP32_DAC
if (dac_continuous_disable(dac_handle) != ESP_OK){
ok = false;
LOGE("dac_continuous_disable failed");
}
if (dac_continuous_del_channels(dac_handle) != ESP_OK){
ok = false;
LOGE("dac_continuous_del_channels failed");
}
#endif
return ok;
}

/// Cleanup Analog to Digital Converter
bool cleanup_rx() {

adc_continuous_stop(adc_handle);
Expand Down

0 comments on commit 5d41c41

Please sign in to comment.