Files
pebble/src/fw/apps/demo_apps/vibe_and_logs.c
2025-01-27 11:38:16 -08:00

82 lines
2.2 KiB
C

/*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "trigger_alarm.h"
#include "applib/ui/vibes.h"
#include "applib/app.h"
#include "process_state/app_state/app_state.h"
#include "applib/ui/app_window_stack.h"
#include "applib/ui/window_stack.h"
#include "kernel/events.h"
#include "drivers/rtc.h"
#include "drivers/vibe.h"
#include "system/logging.h"
Window s_window;
static AppTimer *s_app_timer;
TimerID s_sys_timer = TIMER_INVALID_ID;
static void app_timer_callback(void *data) {
for (int i=0; i<40; i++) {
PBL_LOG(LOG_LEVEL_INFO, "%d Running app timer callback", i);
vibes_short_pulse();
}
s_app_timer = app_timer_register(100 /* milliseconds */, app_timer_callback, NULL);
}
#if 0
static void sys_timer_callback(void* data) {
for (int i=0; i<1; i++) {
PBL_LOG(LOG_LEVEL_INFO, "%d Running sys timer callback", i);
vibes_short_pulse();
}
new_timer_start(s_sys_timer, 20, sys_timer_callback, NULL, 0);
}
#endif
static void handle_init(void) {
window_init(&s_window, WINDOW_NAME("VibeAndLogs Demo"));
const bool animated = true;
app_window_stack_push(&s_window, animated);
s_app_timer = app_timer_register(100 /* milliseconds */, app_timer_callback, NULL);
s_sys_timer = new_timer_create();
//new_timer_start(s_sys_timer, 10, sys_timer_callback, NULL, 0);
}
static void handle_deinit(void) {
}
static void s_main(void) {
handle_init();
app_event_loop();
handle_deinit();
}
const PebbleProcessMd* vibe_and_logs_get_app_info() {
static const PebbleProcessMdSystem s_trigger_alarm = {
.common.main_func = s_main,
.name = "VibeAndLogs"
};
return (const PebbleProcessMd*) &s_trigger_alarm;
}