]> git.earman.xyz Git - sensor-watch.git/commitdiff
never disable buzzer output
authorjoeycastillo <joeycastillo@utexas.edu>
Wed, 4 Jan 2023 03:24:14 +0000 (21:24 -0600)
committerjoeycastillo <joeycastillo@utexas.edu>
Wed, 4 Jan 2023 03:24:14 +0000 (21:24 -0600)
movement/watch_faces/clock/simple_clock_face.c
movement/watch_faces/clock/weeknumber_clock_face.c
movement/watch_faces/complication/alarm_face.c
watch-library/hardware/watch/watch_buzzer.c

index 7721b12a28e1c257aed85b31ebc92b55eb25ea9e..d66e5886a1b6f3f4caf39ba51d2949830981dac0 100644 (file)
@@ -144,12 +144,8 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
                 // if we are in the foreground, we can just beep.
                 movement_play_signal();
             } else {
-                // if we were in the background, we need to enable the buzzer peripheral first,
-                watch_enable_buzzer();
                 // beep quickly (this call blocks for 275 ms),
                 movement_play_signal();
-                // and then turn the buzzer peripheral off again.
-                watch_disable_buzzer();
             }
             break;
         default:
index e49e5abf743b7f6bb13da59c710dc6c065a2e841..deaaedbde2987b8146bba9ae5c1f5a31d11893a8 100644 (file)
@@ -140,12 +140,8 @@ bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *set
                 // if we are in the foreground, we can just beep.
                 movement_play_signal();
             } else {
-                // if we were in the background, we need to enable the buzzer peripheral first,
-                watch_enable_buzzer();
                 // beep quickly (this call blocks for 275 ms),
                 movement_play_signal();
-                // and then turn the buzzer peripheral off again.
-                watch_disable_buzzer();
             }
             break;
         default:
index 35e2890f9900633d83bbf5bcba982b904d382374..181a5abaafecd85e13d6cedaf364421f3533a245 100644 (file)
@@ -421,10 +421,8 @@ bool alarm_face_loop(movement_event_t event, movement_settings_t *settings, void
             if (watch_is_buzzer_or_led_enabled()) {
                 _alarm_play_short_beep(state->alarm[state->alarm_playing_idx].pitch);
             } else {
-                // enable, play beep and disable buzzer again
-                watch_enable_buzzer();
+                // play beep
                 _alarm_play_short_beep(state->alarm[state->alarm_playing_idx].pitch);
-                watch_disable_buzzer();
             }
         } else {
             // regular alarm beeps
index c06242ff5c55bd0763056ec1be9b07230de6bedf..7a5f17043f3aa58a09aa62ebd0273c298408e0ff 100644 (file)
@@ -28,6 +28,7 @@
     if (!hri_tcc_get_CTRLA_reg(TCC0, TCC_CTRLA_ENABLE)) {
         _watch_enable_tcc();
     }
+    gpio_set_pin_direction(BUZZER, GPIO_DIRECTION_OUT);
 }
 inline void watch_set_buzzer_period(uint32_t period) {
     hri_tcc_write_PERBUF_reg(TCC0, period);
@@ -35,6 +36,7 @@ inline void watch_set_buzzer_period(uint32_t period) {
 
 void watch_disable_buzzer(void) {
     _watch_disable_tcc();
+    watch_set_buzzer_off();
 }
 
 inline void watch_set_buzzer_on(void) {
@@ -43,8 +45,8 @@ inline void watch_set_buzzer_on(void) {
 }
 
 inline void watch_set_buzzer_off(void) {
-    gpio_set_pin_direction(BUZZER, GPIO_DIRECTION_OFF);
     gpio_set_pin_function(BUZZER, GPIO_PIN_FUNCTION_OFF);
+    gpio_set_pin_level(BUZZER, true);
 }
 
 void watch_buzzer_play_note(BuzzerNote note, uint16_t duration_ms) {