summaryrefslogtreecommitdiffstats
path: root/watch-library/shared/watch/watch_buzzer.h
diff options
context:
space:
mode:
Diffstat (limited to 'watch-library/shared/watch/watch_buzzer.h')
-rw-r--r--watch-library/shared/watch/watch_buzzer.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/watch-library/shared/watch/watch_buzzer.h b/watch-library/shared/watch/watch_buzzer.h
index 1b5d197c..7ba9a52e 100644
--- a/watch-library/shared/watch/watch_buzzer.h
+++ b/watch-library/shared/watch/watch_buzzer.h
@@ -160,5 +160,28 @@ void watch_buzzer_play_note(BuzzerNote note, uint16_t duration_ms);
/// @brief An array of periods for all the notes on a piano, corresponding to the names in BuzzerNote.
extern const uint16_t NotePeriods[108];
+/** @brief Plays the given sequence of notes in a non-blocking way.
+ * @param note_sequence A pointer to the sequence of buzzer note & duration tuples, ending with a zero. A simple
+ * RLE logic is implemented: a negative number instead of a buzzer note means that the sequence
+ * is rewound by the given number of notes. The byte following a negative number determines the number
+ * of loops. I.e. if you want to repeat the last three notes of the sequence one time, you should provide
+ * the tuple -3, 1. The repeated notes must not contain any other repeat markers, or you will end up with
+ * an eternal loop.
+ * @param callback_on_end A pointer to a callback function to be invoked when the sequence has finished playing.
+ * @note This function plays the sequence asynchronously, so the UI will not be blocked.
+ * Hint: It is not possible to play the lowest note BUZZER_NOTE_A1 (55.00 Hz). The note is represented by a
+ * zero byte, which is used here as the end-of-sequence marker. But hey, a frequency that low cannot be
+ * played properly by the watch's buzzer, anyway.
+ */
+void watch_buzzer_play_sequence(int8_t *note_sequence, void (*callback_on_end)(void));
+
+/** @brief Aborts a playing sequence.
+ */
+void watch_buzzer_abort_sequence(void);
+
+#ifndef __EMSCRIPTEN__
+void TC3_Handler(void);
+#endif
+
/// @}
#endif