fixes 161: sets both CCBUF and PERFBUF for correct buzzer tone (#162)
This commit is contained in:
parent
d0a3fd2377
commit
18de75be5a
@ -32,6 +32,7 @@
|
|||||||
}
|
}
|
||||||
inline void watch_set_buzzer_period(uint32_t period) {
|
inline void watch_set_buzzer_period(uint32_t period) {
|
||||||
hri_tcc_write_PERBUF_reg(TCC0, 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) {
|
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) {
|
if (note == BUZZER_NOTE_REST) {
|
||||||
watch_set_buzzer_off();
|
watch_set_buzzer_off();
|
||||||
} else {
|
} else {
|
||||||
hri_tcc_write_PERBUF_reg(TCC0, NotePeriods[note]);
|
watch_set_buzzer_period(NotePeriods[note]);
|
||||||
hri_tcc_write_CCBUF_reg(TCC0, WATCH_BUZZER_TCC_CHANNEL, NotePeriods[note] / 2);
|
|
||||||
watch_set_buzzer_on();
|
watch_set_buzzer_on();
|
||||||
}
|
}
|
||||||
delay_ms(duration_ms);
|
delay_ms(duration_ms);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user