static void init() { // Subscribe to Wakeup API wakeup_service_subscribe(wakeup_handler); // Register callbacks app_message_register_inbox_received(inbox_received_callback); app_message_register_inbox_dropped(inbox_dropped_callback); app_message_register_outbox_failed(outbox_failed_callback); app_message_register_outbox_sent(outbox_sent_callback); app_message_open(400,400); // Was this a wakeup launch? if (launch_reason() == APP_LAUNCH_WAKEUP) { // The app was started by a wakeup WakeupId id = 0; int32_t reason = 0; // Get details and handle the wakeup wakeup_get_launch_event(&id, &reason); wakeup_handler(id, reason); } else { // Launch main page init_main_window(); // Launch the splash page init_splash_window(); } }
/*---------------------------------------------------------------------------*/ void board_init() { uint8_t int_disabled = ti_lib_int_master_disable(); /* Turn on relevant PDs */ wakeup_handler(); /* Enable GPIO peripheral */ ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO); /* Apply settings and wait for them to take effect */ ti_lib_prcm_load_set(); while (!ti_lib_prcm_load_get()) ; lpm_register_module(&srf_module); /* Re-enable interrupt if initially enabled. */ if (!int_disabled) { ti_lib_int_master_enable(); } /* Init of PWM */ pwm_init(); }
/*---------------------------------------------------------------------------*/ void board_init() { /* Disable global interrupts */ bool int_disabled = ti_lib_int_master_disable(); /* Turn on relevant PDs */ wakeup_handler(); /* Enable GPIO peripheral */ ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO); /* Apply settings and wait for them to take effect */ ti_lib_prcm_load_set(); while(!ti_lib_prcm_load_get()); /* Make sure the external flash is in the lower power mode */ ext_flash_init(); lpm_register_module(&launchpad_module); /* For unsupported peripherals, select a default pin configuration */ configure_unused_pins(); /* Re-enable interrupt if initially enabled. */ if(!int_disabled) { ti_lib_int_master_enable(); } }