diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-09-30 16:32:59 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-09-30 16:32:59 -0400 |
commit | 15ae7ab84b13953ec309a5823ade6ddb60f6a68c (patch) | |
tree | 51040cf359ce8297247a47fa1b63dbec9ac2fb28 | |
parent | 20db34a9c0fa3d12b2042774e541fc0bcb7fb2b6 (diff) | |
download | Sensor-Watch-15ae7ab84b13953ec309a5823ade6ddb60f6a68c.tar.gz Sensor-Watch-15ae7ab84b13953ec309a5823ade6ddb60f6a68c.tar.bz2 Sensor-Watch-15ae7ab84b13953ec309a5823ade6ddb60f6a68c.zip |
add beep to starter app
-rw-r--r-- | apps/Sensor Watch Starter Project/app.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/Sensor Watch Starter Project/app.c b/apps/Sensor Watch Starter Project/app.c index 5c3c77af..ff5ed53d 100644 --- a/apps/Sensor Watch Starter Project/app.c +++ b/apps/Sensor Watch Starter Project/app.c @@ -20,6 +20,7 @@ typedef struct ApplicationState { ApplicationMode mode; LightColor color; bool light_on; + bool beep; uint8_t wake_count; bool enter_sleep_mode; } ApplicationState; @@ -74,6 +75,7 @@ void app_wake_from_deep_sleep() { */ void app_setup() { watch_enable_leds(); + watch_enable_buzzer(); watch_enable_external_interrupts(); // This starter app demonstrates three different ways of using the button interrupts. @@ -113,6 +115,11 @@ void app_wake_from_sleep() { * the watch STANDBY sleep mode. */ bool app_loop() { + if (application_state.beep) { + watch_buzzer_play_note(BUZZER_NOTE_C7, 50); + application_state.beep = false; + } + // set the LED to a color if (application_state.light_on) { switch (application_state.color) { @@ -181,6 +188,7 @@ void cb_light_pressed() { void cb_mode_pressed() { application_state.mode = (application_state.mode + 1) % 2; + application_state.beep = true; } void cb_alarm_pressed() { |