miketsai 286291fcfd feat(buzzer): add GPIO64 buzzer module with pattern-based alerts
New buzzer.h/buzzer.c: background pthread drives gpio64 with three
patterns (GRASS 500/500ms, ALERT 300/200ms, COLLISION 100/100ms).
Integrated into fire_collision_warning(), fire_alert(), and grass
state machine in event_recorder.c; buzzer_init() called after
can_bus_init() in kp_firmware.c.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-12 18:09:54 +08:00

24 lines
678 B
C

/*
* buzzer.h — GPIO-driven buzzer control (gpio64)
*
* Background thread plays a continuous pattern until changed.
* Pattern priority (highest wins): COLLISION > ALERT > GRASS > OFF
* Callers set the desired pattern; the module handles GPIO toggling.
*/
#ifndef BUZZER_H
#define BUZZER_H
typedef enum {
BUZZER_PATTERN_OFF = 0,
BUZZER_PATTERN_GRASS = 1, /* 500ms on / 500ms off */
BUZZER_PATTERN_ALERT = 2, /* 300ms on / 200ms off */
BUZZER_PATTERN_COLLISION = 3, /* 100ms on / 100ms off */
} buzzer_pattern_t;
int buzzer_init(void);
void buzzer_set_pattern(buzzer_pattern_t pattern);
void buzzer_close(void);
#endif /* BUZZER_H */