My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

buzzer.cpp 495B

12345678910111213141516171819202122
  1. #include "Marlin.h"
  2. #include "buzzer.h"
  3. #include "ultralcd.h"
  4. #if HAS_BUZZER
  5. void buzz(long duration, uint16_t freq) {
  6. if (freq > 0) {
  7. #ifdef LCD_USE_I2C_BUZZER
  8. lcd_buzz(duration, freq);
  9. #elif defined(BEEPER) && BEEPER >= 0 // on-board buzzers have no further condition
  10. SET_OUTPUT(BEEPER);
  11. tone(BEEPER, freq, duration);
  12. delay(duration);
  13. #else
  14. delay(duration);
  15. #endif
  16. }
  17. else {
  18. delay(duration);
  19. }
  20. }
  21. #endif