From c4e573a638a0bb1ec208069294b9f606c6f8b8e8 Mon Sep 17 00:00:00 2001 From: eadmaster <925171+eadmaster@users.noreply.github.com> Date: Mon, 5 Aug 2024 00:14:16 +0200 Subject: [PATCH] BUZZ_PIN and tone function optional (#113) --- platformio.ini | 3 +++ src/core/globals.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/platformio.ini b/platformio.ini index 885ce9a1..d91aec41 100644 --- a/platformio.ini +++ b/platformio.ini @@ -67,6 +67,9 @@ build_flags = ;Have RTC Chip -DHAS_RTC=1 + + ;Have buzzer + -DBUZZ_PIN=2 ;Buttons configuration -DHAS_BTN=1 diff --git a/src/core/globals.cpp b/src/core/globals.cpp index 1acb7b7b..f649d943 100644 --- a/src/core/globals.cpp +++ b/src/core/globals.cpp @@ -1,7 +1,5 @@ #include "globals.h" -#define BUZZ_PIN 2 - /********************************************************************* ** Function: backToMenu ** sets the global var to be be used in the options second parameter @@ -74,5 +72,9 @@ void updateTimeStr(struct tm timeInfo) { } void _tone(unsigned int frequency, unsigned long duration = 0UL) { +#if defined(BUZZ_PIN) tone(BUZZ_PIN, frequency, duration); +//#elif defined(HAS_NS4168_SPKR) +//TODO: alt. implementation using the speaker +#endif }