Add active buzzer test with SoftSPI touch and LVGL.
GPIO22 digital on/off toggle (default off) and flashable firmware/cyd package. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
25
src/buzzer.cpp
Normal file
25
src/buzzer.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "buzzer.h"
|
||||
#include "pins.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
static bool g_on = false;
|
||||
|
||||
static void apply() {
|
||||
digitalWrite(BUZZER_PIN, g_on ? HIGH : LOW);
|
||||
}
|
||||
|
||||
void buzzer_init() {
|
||||
pinMode(BUZZER_PIN, OUTPUT);
|
||||
g_on = false;
|
||||
apply();
|
||||
Serial.printf("Buzzer GPIO%d OFF (default)\n", BUZZER_PIN);
|
||||
}
|
||||
|
||||
void buzzer_set_on(bool on) {
|
||||
g_on = on;
|
||||
apply();
|
||||
Serial.printf("Buzzer %s\n", g_on ? "ON" : "OFF");
|
||||
}
|
||||
|
||||
bool buzzer_is_on() { return g_on; }
|
||||
Reference in New Issue
Block a user