diff options
-rw-r--r-- | apps/functional-test/app.c | 105 | ||||
-rwxr-xr-x | apps/functional-test/make/Makefile | 10 | ||||
-rw-r--r-- | movement/watch_faces/demos/demo_face.c | 42 |
3 files changed, 149 insertions, 8 deletions
diff --git a/apps/functional-test/app.c b/apps/functional-test/app.c new file mode 100644 index 00000000..b4ee0412 --- /dev/null +++ b/apps/functional-test/app.c @@ -0,0 +1,105 @@ +#include <stdio.h> +#include <string.h> +#include "watch.h" + +bool even = false; +bool beep = false; +uint32_t i = 0; + +static void cb_tick(void) { + beep = true; + even = !even; +} + +void app_init(void) { +} + +void app_wake_from_backup(void) { +} + +void app_setup(void) { + watch_enable_display(); + + watch_enable_buzzer(); + + watch_enable_digital_output(A0); + watch_enable_digital_output(SCL); + watch_enable_digital_output(SDA); + watch_enable_digital_output(A1); + watch_enable_digital_output(A2); + watch_enable_digital_output(A3); + watch_enable_digital_output(A4); + + watch_enable_digital_input(BTN_ALARM); + watch_enable_digital_input(BTN_LIGHT); + watch_enable_digital_input(BTN_MODE); + watch_enable_pull_down(BTN_ALARM); + watch_enable_pull_down(BTN_LIGHT); + watch_enable_pull_down(BTN_MODE); + + watch_set_pin_level(A0, false); + watch_set_pin_level(SCL, false); + watch_set_pin_level(SDA, false); + watch_set_pin_level(A1, false); + watch_set_pin_level(A2, false); + watch_set_pin_level(A3, false); + watch_set_pin_level(A4, false); + + watch_rtc_register_periodic_callback(cb_tick, 2); +} + +void app_prepare_for_standby(void) { +} + +void app_wake_from_standby(void) { +} + +bool app_loop(void) { + char buf[14]; + + if (beep) watch_buzzer_play_note(BUZZER_NOTE_E5, 100); + + if (even) { + printf("Flashing even lights\n"); + #ifdef WATCH_SWAP_LED_PINS + sprintf(buf, "WT%2d'blu_E", (uint8_t)(i++ % 40)); + #else + sprintf(buf, "WT%2d'Grn_E", (uint8_t)(i++ % 40)); + #endif + watch_set_led_green(); + watch_set_pin_level(A0, true); + watch_set_pin_level(SCL, false); + watch_set_pin_level(SDA, true); + watch_set_pin_level(A1, false); + watch_set_pin_level(A2, true); + watch_set_pin_level(A3, false); + watch_set_pin_level(A4, true); + } else { + printf("Flashing odd lights\n"); + sprintf(buf, "WT%2d-red~O", (uint8_t)(i++ % 40)); + watch_display_string(buf, 0); + watch_set_led_red(); + watch_set_pin_level(A0, false); + watch_set_pin_level(SCL, true); + watch_set_pin_level(SDA, false); + watch_set_pin_level(A1, true); + watch_set_pin_level(A2, false); + watch_set_pin_level(A3, true); + watch_set_pin_level(A4, false); + } + if (watch_get_pin_level(BTN_ALARM)) { + buf[2] = 'a'; + buf[3] = 'L'; + } + if (watch_get_pin_level(BTN_LIGHT)) { + buf[2] = '1'; + buf[3] = 'i'; + } + if (watch_get_pin_level(BTN_MODE)) { + buf[2] = '-'; + buf[3] = 'O'; + } + watch_display_string(buf, 0); + + return true; +} diff --git a/apps/functional-test/make/Makefile b/apps/functional-test/make/Makefile new file mode 100755 index 00000000..c66ad20c --- /dev/null +++ b/apps/functional-test/make/Makefile @@ -0,0 +1,10 @@ +TOP = ../../.. +include $(TOP)/make.mk + +INCLUDES += \ + -I../ + +SRCS += \ + ../app.c + +include $(TOP)/rules.mk diff --git a/movement/watch_faces/demos/demo_face.c b/movement/watch_faces/demos/demo_face.c index 44a180ab..543d41ea 100644 --- a/movement/watch_faces/demos/demo_face.c +++ b/movement/watch_faces/demos/demo_face.c @@ -4,12 +4,17 @@ #include "watch.h" typedef enum { - DEMO_FACE_HELLO = 0, - DEMO_FACE_TIME, + DEMO_FACE_TIME = 0, DEMO_FACE_WORLD_TIME, DEMO_FACE_BEATS, + DEMO_FACE_TOTP, DEMO_FACE_TEMP_F, DEMO_FACE_TEMP_C, + DEMO_FACE_TEMP_LOG_1, + DEMO_FACE_TEMP_LOG_2, + DEMO_FACE_DAY_ONE, + DEMO_FACE_STOPWATCH, + DEMO_FACE_PULSOMETER, DEMO_FACE_BATTERY_VOLTAGE, DEMO_FACE_NUM_FACES } demo_face_index_t; @@ -29,6 +34,7 @@ void demo_face_activate(movement_settings_t *settings, void *context) { movement_request_tick_frequency(0); // ensure the watch never enters low energy mode settings->bit.le_interval = 0; + settings->bit.led_duration = 3; } bool demo_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { @@ -46,27 +52,47 @@ bool demo_face_loop(movement_event_t event, movement_settings_t *settings, void // fall through case EVENT_ACTIVATE: switch (*screen) { - case DEMO_FACE_HELLO: - watch_display_string(" Hello ", 0); - watch_clear_colon(); - break; case DEMO_FACE_TIME: - watch_display_string("TH 6101036", 0); + watch_display_string("TH10101036", 0); watch_set_colon(); break; case DEMO_FACE_WORLD_TIME: - watch_display_string("MT 6 81036", 0); + watch_display_string("UT10 21036", 0); + watch_set_indicator(WATCH_INDICATOR_PM); break; case DEMO_FACE_BEATS: watch_display_string("bt 64125", 0); + watch_clear_indicator(WATCH_INDICATOR_PM); watch_clear_colon(); break; + case DEMO_FACE_TOTP: + watch_display_string("2F29808494", 0); + break; case DEMO_FACE_TEMP_F: watch_display_string("TE 72.1#F", 0); break; case DEMO_FACE_TEMP_C: watch_display_string("TE 22.3#C", 0); break; + case DEMO_FACE_TEMP_LOG_1: + watch_display_string("TL 43.6#F", 0); + break; + case DEMO_FACE_TEMP_LOG_2: + watch_display_string("AT 6100000", 0); + watch_set_colon(); + break; + case DEMO_FACE_DAY_ONE: + watch_clear_colon(); + watch_display_string("DA 12879", 0); + break; + case DEMO_FACE_STOPWATCH: + watch_display_string("ST 01042 ", 0); + watch_set_colon(); + break; + case DEMO_FACE_PULSOMETER: + watch_display_string(" 68 bpn", 0); + watch_clear_colon(); + break; case DEMO_FACE_BATTERY_VOLTAGE: watch_display_string("BA 2.97 V", 0); break; |