summaryrefslogtreecommitdiffstats
path: root/watch-library
diff options
context:
space:
mode:
authorgugray <gugray@users.noreply.github.com>2023-01-10 22:33:29 +0100
committerGitHub <noreply@github.com>2023-01-10 16:33:29 -0500
commit18de75be5a1391c00b772a669b3583b8567fa194 (patch)
tree68e93130ae011d372566ecac7df21b26e201c485 /watch-library
parentd0a3fd23778fec57c6010c0ee04d038a0bae34e4 (diff)
downloadSensor-Watch-18de75be5a1391c00b772a669b3583b8567fa194.tar.gz
Sensor-Watch-18de75be5a1391c00b772a669b3583b8567fa194.tar.bz2
Sensor-Watch-18de75be5a1391c00b772a669b3583b8567fa194.zip
fixes 161: sets both CCBUF and PERFBUF for correct buzzer tone (#162)
Diffstat (limited to 'watch-library')
-rw-r--r--watch-library/hardware/watch/watch_buzzer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/watch-library/hardware/watch/watch_buzzer.c b/watch-library/hardware/watch/watch_buzzer.c
index 7a5f1704..07303482 100644
--- a/watch-library/hardware/watch/watch_buzzer.c
+++ b/watch-library/hardware/watch/watch_buzzer.c
@@ -32,6 +32,7 @@
}
inline void watch_set_buzzer_period(uint32_t period) {
hri_tcc_write_PERBUF_reg(TCC0, period);
+ hri_tcc_write_CCBUF_reg(TCC0, WATCH_BUZZER_TCC_CHANNEL, period / 2);
}
void watch_disable_buzzer(void) {
@@ -53,8 +54,7 @@ void watch_buzzer_play_note(BuzzerNote note, uint16_t duration_ms) {
if (note == BUZZER_NOTE_REST) {
watch_set_buzzer_off();
} else {
- hri_tcc_write_PERBUF_reg(TCC0, NotePeriods[note]);
- hri_tcc_write_CCBUF_reg(TCC0, WATCH_BUZZER_TCC_CHANNEL, NotePeriods[note] / 2);
+ watch_set_buzzer_period(NotePeriods[note]);
watch_set_buzzer_on();
}
delay_ms(duration_ms);