diff options
author | Shogo Okamoto <shogo.okamoto@gmail.com> | 2022-11-08 22:39:02 +0900 |
---|---|---|
committer | Shogo Okamoto <shogo.okamoto@gmail.com> | 2022-11-08 22:39:02 +0900 |
commit | eff3529b96a49f04d4d0ff897e06f54dbfbd133d (patch) | |
tree | 53712ec805d8f7588e73741ff15d60fd907d3cf5 /movement | |
parent | c149fef92da97e0ce87534e357075e39c776e15d (diff) | |
download | Sensor-Watch-eff3529b96a49f04d4d0ff897e06f54dbfbd133d.tar.gz Sensor-Watch-eff3529b96a49f04d4d0ff897e06f54dbfbd133d.tar.bz2 Sensor-Watch-eff3529b96a49f04d4d0ff897e06f54dbfbd133d.zip |
append beep sound to counter_face
Diffstat (limited to 'movement')
-rw-r--r-- | movement/watch_faces/complication/counter_face.c | 22 | ||||
-rw-r--r-- | movement/watch_faces/complication/counter_face.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/movement/watch_faces/complication/counter_face.c b/movement/watch_faces/complication/counter_face.c index ac0388ab..fb03ce67 100644 --- a/movement/watch_faces/complication/counter_face.c +++ b/movement/watch_faces/complication/counter_face.c @@ -59,6 +59,7 @@ bool counter_face_loop(movement_event_t event, movement_settings_t *settings, vo state->counter_idx=0;//reset counter index } print_counter(state); + beep_counter(state); break; case EVENT_ALARM_LONG_PRESS: state->counter_idx=0; // reset counter index @@ -77,6 +78,27 @@ bool counter_face_loop(movement_event_t event, movement_settings_t *settings, vo return true; } +// beep counter index times +void beep_counter(counter_state_t *state) { + + int low_count = state->counter_idx/5; + int high_count = state->counter_idx - low_count * 5; + + for (int i=0; i<low_count; i++) { + watch_buzzer_play_note(BUZZER_NOTE_A6, 50); + watch_buzzer_play_note(BUZZER_NOTE_REST, 100); + } + + //sleep between high and low + watch_buzzer_play_note(BUZZER_NOTE_REST, 200); + + for (int i=0; i<high_count; i++) { + watch_buzzer_play_note(BUZZER_NOTE_B6, 50); + watch_buzzer_play_note(BUZZER_NOTE_REST, 100); + } +} + + // print counter index at the center of display. void print_counter(counter_state_t *state) { char buf[14]; diff --git a/movement/watch_faces/complication/counter_face.h b/movement/watch_faces/complication/counter_face.h index 2d389a15..430f5a8e 100644 --- a/movement/watch_faces/complication/counter_face.h +++ b/movement/watch_faces/complication/counter_face.h @@ -39,6 +39,7 @@ bool counter_face_loop(movement_event_t event, movement_settings_t *settings, vo void counter_face_resign(movement_settings_t *settings, void *context); void print_counter(counter_state_t *state); +void beep_counter(counter_state_t *state); #define counter_face ((const watch_face_t){ \ counter_face_setup, \ |