Skip to content

Commit

Permalink
BUZZ_PIN and tone function optional (pr3y#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
eadmaster committed Aug 4, 2024
1 parent 4ba4f25 commit c4e573a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ build_flags =

;Have RTC Chip
-DHAS_RTC=1

;Have buzzer
-DBUZZ_PIN=2

;Buttons configuration
-DHAS_BTN=1
Expand Down
6 changes: 4 additions & 2 deletions src/core/globals.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
}

0 comments on commit c4e573a

Please sign in to comment.