From e9fe4aeefe7e56d637f7fbf35772f5bb37aff911 Mon Sep 17 00:00:00 2001 From: Wesley Aptekar-Cassels Date: Mon, 13 Nov 2023 00:48:57 -0500 Subject: Enable custom signal tones in LE mode. This makes movement_play_signal synchronous when in LE mode, despite using the underlying asynchronous API. It's a bit of a hack, but it should work well enough for now. This also moves the enabling/disabling of the buzzer into the movement_play_signal function, so that watch faces no longer have to do it. --- watch-library/hardware/watch/watch_buzzer.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'watch-library/hardware') diff --git a/watch-library/hardware/watch/watch_buzzer.c b/watch-library/hardware/watch/watch_buzzer.c index 18fb4db0..63506a51 100644 --- a/watch-library/hardware/watch/watch_buzzer.c +++ b/watch-library/hardware/watch/watch_buzzer.c @@ -90,6 +90,15 @@ void watch_buzzer_play_sequence(int8_t *note_sequence, void (*callback_on_end)(v _tc3_start(); } +uint16_t sequence_length(int8_t *sequence) { + uint16_t result = 0; + int i = 0; + while (sequence[i++]) { + result += sequence[i++]; + } + return result; +} + void cb_watch_buzzer_seq(void) { // callback for reading the note sequence if (_tone_ticks == 0) { -- cgit v1.2.3 From 50dccd07d3fe39f1a0f4648dd3812561d4a52974 Mon Sep 17 00:00:00 2001 From: Wesley Aptekar-Cassels Date: Wed, 15 Nov 2023 19:21:43 -0500 Subject: buzzer: fix simulator build, refactor sequence_length. --- watch-library/hardware/watch/watch_buzzer.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'watch-library/hardware') diff --git a/watch-library/hardware/watch/watch_buzzer.c b/watch-library/hardware/watch/watch_buzzer.c index 63506a51..2dce8d23 100644 --- a/watch-library/hardware/watch/watch_buzzer.c +++ b/watch-library/hardware/watch/watch_buzzer.c @@ -23,6 +23,7 @@ */ #include "watch_buzzer.h" +#include "watch_private_buzzer.h" #include "../../../watch-library/hardware/include/saml22j18a.h" #include "../../../watch-library/hardware/include/component/tc.h" #include "../../../watch-library/hardware/hri/hri_tc_l22.h" @@ -90,15 +91,6 @@ void watch_buzzer_play_sequence(int8_t *note_sequence, void (*callback_on_end)(v _tc3_start(); } -uint16_t sequence_length(int8_t *sequence) { - uint16_t result = 0; - int i = 0; - while (sequence[i++]) { - result += sequence[i++]; - } - return result; -} - void cb_watch_buzzer_seq(void) { // callback for reading the note sequence if (_tone_ticks == 0) { -- cgit v1.2.3