diff options
| author | Joey Castillo <joeycastillo@utexas.edu> | 2021-12-10 15:55:54 -0500 |
|---|---|---|
| committer | Joey Castillo <joeycastillo@utexas.edu> | 2021-12-10 15:55:54 -0500 |
| commit | e4f9737e21b6489be04e43f0af23aa968dba9ac2 (patch) | |
| tree | 17475ccb72febde21425530eddce606f0176e23a /apps/Sensor Watch Buzzer Demo | |
| parent | 8571bfa74f4de75fbb55b37e97de80351f5e92fe (diff) | |
| parent | 762af872d2f2c977e51d6e51b8c3ad622485cc05 (diff) | |
| download | Sensor-Watch-e4f9737e21b6489be04e43f0af23aa968dba9ac2.tar.gz Sensor-Watch-e4f9737e21b6489be04e43f0af23aa968dba9ac2.tar.bz2 Sensor-Watch-e4f9737e21b6489be04e43f0af23aa968dba9ac2.zip | |
Merge branch 'main' into movement-timer-stuff
Diffstat (limited to 'apps/Sensor Watch Buzzer Demo')
| -rw-r--r-- | apps/Sensor Watch Buzzer Demo/app.c | 134 | ||||
| -rwxr-xr-x | apps/Sensor Watch Buzzer Demo/make/Makefile | 10 |
2 files changed, 0 insertions, 144 deletions
diff --git a/apps/Sensor Watch Buzzer Demo/app.c b/apps/Sensor Watch Buzzer Demo/app.c deleted file mode 100644 index 58158dff..00000000 --- a/apps/Sensor Watch Buzzer Demo/app.c +++ /dev/null @@ -1,134 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include "watch.h" - -typedef struct ApplicationState { - bool play; -} ApplicationState; - -ApplicationState application_state; - - -void cb_alarm_pressed() { - application_state.play = true; -} - -void app_init() { - memset(&application_state, 0, sizeof(application_state)); -} - -void app_wake_from_backup() { -} - -void app_setup() { - watch_register_extwake_callback(BTN_ALARM, cb_alarm_pressed, true); - - watch_enable_display(); - - watch_enable_buzzer(); -} - -void app_prepare_for_standby() { - watch_display_string(" rains ", 2); -} - -void app_wake_from_standby() { -} - -bool app_loop() { - if (application_state.play) { - printf("Playing song...\n"); - const BuzzerNote rains[] = { - BUZZER_NOTE_A4, - BUZZER_NOTE_F5, - BUZZER_NOTE_REST, - BUZZER_NOTE_A4, - BUZZER_NOTE_E5, - BUZZER_NOTE_REST, - BUZZER_NOTE_A4, - BUZZER_NOTE_F5, - BUZZER_NOTE_G5, - BUZZER_NOTE_E5, - BUZZER_NOTE_REST, - BUZZER_NOTE_A4, - BUZZER_NOTE_G5, - BUZZER_NOTE_F5, - BUZZER_NOTE_E5, - BUZZER_NOTE_D5, - BUZZER_NOTE_E5, - BUZZER_NOTE_REST, - - BUZZER_NOTE_A5, - BUZZER_NOTE_REST, - BUZZER_NOTE_A5, - BUZZER_NOTE_A5SHARP_B5FLAT, - BUZZER_NOTE_G5, - BUZZER_NOTE_REST, - BUZZER_NOTE_C5, - BUZZER_NOTE_A5, - BUZZER_NOTE_A5SHARP_B5FLAT, - BUZZER_NOTE_G5, - BUZZER_NOTE_REST, - BUZZER_NOTE_D5, - BUZZER_NOTE_A5SHARP_B5FLAT, - BUZZER_NOTE_A5, - BUZZER_NOTE_G5, - BUZZER_NOTE_F5, - BUZZER_NOTE_E5, - }; - const uint16_t durations[] = { - 200, - 600, - 100, - 200, - 600, - 100, - 200, - 400, - 400, - 600, - 100, - 200, - 400, - 400, - 400, - 400, - 800, - 600, - - 200, - 50, - 400, - 200, - 400, - 100, - 200, - 400, - 400, - 400, - 200, - 200, - 400, - 400, - 400, - 400, - 900, - }; - application_state.play = false; - for(size_t i = 0; i < sizeof(rains); i++) { - char buf[9] = {0}; - if (rains[i] == BUZZER_NOTE_REST) { - printf("rest for %d ms\n", durations[i]); - sprintf(buf, "%2drESt ", i); - } else { - printf("playing note %2d: %3.0f Hz for %d ms\n", i, 1000000.0 / (float)NotePeriods[rains[i]], durations[i]); - sprintf(buf, "%2d%6d", i, NotePeriods[rains[i]]); - } - watch_display_string(buf, 2); - watch_buzzer_play_note(rains[i], durations[i]); - } - printf("done!\n\n"); - } - - return true; -} diff --git a/apps/Sensor Watch Buzzer Demo/make/Makefile b/apps/Sensor Watch Buzzer Demo/make/Makefile deleted file mode 100755 index c66ad20c..00000000 --- a/apps/Sensor Watch Buzzer Demo/make/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -TOP = ../../.. -include $(TOP)/make.mk - -INCLUDES += \ - -I../ - -SRCS += \ - ../app.c - -include $(TOP)/rules.mk |
