From ecf503041cfc8fc23b65a4e2c239cd745803ce04 Mon Sep 17 00:00:00 2001 From: xcs011 Date: Fri, 16 Aug 2024 23:03:48 -0400 Subject: [PATCH] Migrate functions to ESP32 Core V3.0.0 standards Migrated functions to new standards according to migration guide https://github.com/espressif/arduino-esp32/blob/master/docs/en/migration_guides/2.x_to_3.0.rst#ledc --- src/utility/Speaker.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/utility/Speaker.cpp b/src/utility/Speaker.cpp index 9288407..d608a92 100644 --- a/src/utility/Speaker.cpp +++ b/src/utility/Speaker.cpp @@ -7,14 +7,13 @@ SPEAKER::SPEAKER(void) { void SPEAKER::begin() { _begun = true; - ledcSetup(TONE_PIN_CHANNEL, 0, 13); - ledcAttachPin(SPEAKER_PIN, TONE_PIN_CHANNEL); + ledcAttach(TONE_PIN_CHANNEL, 0, 13); setBeep(4000, 100); } void SPEAKER::end() { mute(); - ledcDetachPin(SPEAKER_PIN); + ledcDetach(SPEAKER_PIN); _begun = false; } @@ -75,6 +74,5 @@ void SPEAKER::playMusic(const uint8_t* music_data, uint16_t sample_rate) { delay(2); } } - // ledcSetup(TONE_PIN_CHANNEL, 0, 13); - ledcAttachPin(SPEAKER_PIN, TONE_PIN_CHANNEL); + ledcAttach(TONE_PIN_CHANNEL, 0, 13); }