void start(void) { clock_app_init(); //start the command daemon.. mos_thread_new(mos_command_daemon, 128, PRIORITY_NORMAL); mos_register_function("set_time", set_time); mos_register_function("show_time", print_time); mos_register_function("constant", set_constant_update); mos_register_function("stop", stop_constant_update); }
int main(void) { memset(apps, '\0', sizeof(apps)); apps[0] = clock_app_init(); apps[1] = alarm_app_init(); gpioint_set(2, BUTTON_STAR_PIN, (GPIOINT_RISING_EDGE | GPIOINT_DEBOUNCE), button_star); button_thread = thread_getpid(); int active_app = 0; msg_t m; //buzzer_beep(15, 5000); printf("ukleos\n"); m.type = MSG_ACTIVATE; msg_send(&m, apps[active_app], true); while(1) { msg_receive(&m); switch (m.type) { case MSG_BUTTON_STAR: { m.type = MSG_DEACTIVATE; msg_send(&m, apps[active_app], true); active_app++; if (active_app == (NUM_APPS)) active_app = 0; m.type = MSG_ACTIVATE; msg_send(&m, apps[active_app], true); // buzzer_beep(15, 5000); break; } case MSG_BUTTON_HASH: { m.type = MSG_BUTTON_HASH; msg_send(&m, apps[active_app], true); break; } default: { printf("msg\n"); } } } }