/*! \brief Main function. */ int main(void) { irq_initialize_vectors(); #if SAMD20 system_init(); delay_init(); #else sysclk_init(); /* Initialize the board. * The board-specific conf_board.h file contains the configuration of * the board initialization. */ board_init(); #endif sw_timer_init(); serial_interface_init(); if (MAC_SUCCESS != wpan_init()) { app_alert(); } LED_On(LED_POWER); cpu_irq_enable(); while (1) { wpan_task(); serial_data_handler(); } }
void init_state_init(void *arg) { sw_timer_init(); /* Set the node information base */ config_node_ib(); /* Initialize the TAL layer */ if (tal_init() != MAC_SUCCESS) { /* something went wrong during initialization */ app_alert(); } app_timers_init(); /* Initilaize sio rx state */ init_sio(); /* select the configurtion mode */ configuration_mode_selection(); #if (TAL_TYPE == AT86RF233) && (ANTENNA_DIVERSITY == 1) /* In order to demonstrate RPC the antenna diversity is disabled. */ tal_ant_div_config(ANT_DIVERSITY_DISABLE, ANT_CTRL_1); /* Enable A1/X2 */ #endif /* Keep compiler happy */ arg = arg; }
void startup() { set_core_freq(STARTUP_CORE_FREQ); #ifndef NVIC_PRESENT irq_init(); #endif //NVIC_PRESENT //initialize system memory pools mem_init(); //initialize thread subsystem, create idle task thread_init(); #if (DBG_CONSOLE) dbg_console_create(); #endif #if (SW_TIMER_MODULE) sw_timer_init(); #endif //initialize RTC sys_time_init(); //initialize system timers sys_timer_init(); //user application initialize application_init(); //initialize seed srand(); }
/** * \brief Configure Timer module. */ static void configure_timer(void) { struct sw_timer_config swt_conf; sw_timer_get_config_defaults(&swt_conf); sw_timer_init(&swt_module_inst, &swt_conf); sw_timer_enable(&swt_module_inst); }
/** * @brief Main function of the Terminal Target application */ int main(void) { irq_initialize_vectors(); sysclk_init(); /* Initialize the board. * The board-specific conf_board.h file contains the configuration of * the board initialization. */ board_init(); sw_timer_init(); if (nwk_init()!= NWK_SUCCESS) { app_alert(); } zrc_ind.vendor_data_ind_cb = vendor_data_ind; #ifdef ZRC_CMD_DISCOVERY zrc_ind.zrc_cmd_disc_indication_cb = zrc_cmd_disc_indication; #endif zrc_ind.zrc_cmd_indication_cb = zrc_cmd_indication; register_zrc_indication_callback(&zrc_ind); nwk_ind.nwk_ch_agility_indication_cb = nwk_ch_agility_indication; nwk_ind.nlme_unpair_indication_cb = nlme_unpair_indication; register_nwk_indication_callback(&nwk_ind); /* Initialize LEDs. */ LED_On(LED_START); /* indicating application is started */ LED_Off(LED_NWK_SETUP); /* indicating network is started */ LED_Off(LED_DATA); /* indicating data reception */ /* * The stack is initialized above, hence the global interrupts are *enabled * here. */ cpu_irq_enable(); #ifdef SIO_HUB /* Initialize the serial interface used for communication with terminal *program. */ sio2host_init(); #endif sw_timer_get_id(&led_timer); /* Endless while loop */ while (1) { app_task(); /* Application task */ nwk_task(); /* RF4CE network layer task */ } }
/** * Main function, initialization and main message loop * */ int main(void) { irq_initialize_vectors(); /* Initialize the board.*/ board_init(); /* Initialize the Software timer */ sw_timer_init(); /* Init the RF4CE Network layer */ if (nwk_init()!= NWK_SUCCESS) { app_alert(); } #ifdef RF4CE_CALLBACK_PARAM /* Register the ZID Callback indication */ zid_ind.zid_report_data_indication_cb = zid_report_data_indication; zid_ind.zid_get_report_indication_cb = zid_get_report_indication; register_zid_indication_callback(&zid_ind); #endif /* * The stack is initialized above, * hence the global interrupts are enabled here. */ cpu_irq_enable(); sw_timer_get_id(&APP_TIMER_ACC_READ); if (get_zid_keyrc_button(button_scan()) == ZID_COLD_START) { /* Cold start */ LED_On(ZID_APP_LED); node_status = COLD_START; nlme_reset_request(true #ifdef RF4CE_CALLBACK_PARAM ,(FUNC_PTR)nlme_reset_confirm #endif ); } else { /* Warm start */ node_status = WARM_START; nlme_reset_request(false #ifdef RF4CE_CALLBACK_PARAM ,(FUNC_PTR)nlme_reset_confirm #endif ); } /* Endless while loop */ while (1) { app_task(); /* Application task */ nwk_task(); /* RF4CE network layer task */ } }
static void _thethingsio_mqtt_configure_timer(void) { struct sw_timer_config swt_conf_mqtt; sw_timer_get_config_defaults(&swt_conf_mqtt); sw_timer_init(&swt_module_mqtt_inst, &swt_conf_mqtt); sw_timer_enable(&swt_module_mqtt_inst); }
/*! \brief Main function. */ int main(void) { /* Initialize the board. * The board-specific conf_board.h file contains the configuration of * the board initialization. */ irq_initialize_vectors(); board_init(); sysclk_init(); sw_timer_init(); if(MAC_SUCCESS != wpan_init()) { /* * Stay here; we need a valid IEEE address. * Check kit documentation how to create an IEEE address * and to store it into the EEPROM. */ app_alert(); } /* Initialize LEDs. */ LED_On(LED_START); // indicating application is started LED_Off(LED_NWK_SETUP); // indicating node is associated LED_Off(LED_DATA); // indicating successfull data transmission cpu_irq_enable(); sw_timer_get_id(&TIMER_LED_OFF); sw_timer_get_id(&WAKE_TIMER); node_status = COLD_START_RESET; /* * Reset the MAC layer to the default values * This request will cause a mlme reset confirm message -> * usr_mlme_reset_conf */ wpan_mlme_reset_req(true); /* Main loop */ while (true) { wpan_task(); app_task(); /* Application task */ } }
/** * \brief Run Wireless Module unit tests * * Initializes the clock system, board and USB. * Then runs the wireless task continuously. */ int main(void) { irq_initialize_vectors(); board_init(); sysclk_init(); sw_timer_init(); nwk_init(); /* Enable interrupts */ cpu_irq_enable(); stdio_usb_init(); while (1) { nwk_task(); } }
/** * Main function, initialization and main message loop * * @return error code */ int main(void) { irq_initialize_vectors(); #if SAMD21 || SAMD20 || SAMR21 system_init(); delay_init(); #else sysclk_init(); /* Initialize the board. * The board-specific conf_board.h file contains the configuration of * the board initialization. */ board_init(); #endif sw_timer_init(); if (nwk_init() != NWK_SUCCESS) { app_alert(); } stack_indication_callback_init(); #ifdef FLASH_NVRAM pal_ps_set(EE_IEEE_ADDR, 8, &tal_pib.IeeeAddress); #endif /* Initialize LEDs */ /* pal_led_init(); */ cpu_irq_enable(); /* * The global interrupt has to be enabled here as TAL uses the timer * delay which in turn requires interrupt to be enabled */ /* pal_global_irq_enable(); */ serial_interface_init(); /* Loop forever, the interrupts are doing the rest */ while (1) { nwk_task(); serial_data_handler(); } /* No return statement here, because this code is unreachable */ }
/** * @brief Main function of the device application */ int main(void) { /* Initialize the board. * The board-specific conf_board.h file contains the configuration of * the board initialization. */ irq_initialize_vectors(); board_init(); sysclk_init(); sw_timer_init(); if(MAC_SUCCESS != wpan_init()) { app_alert(); } /* Initialize LEDs. */ LED_On(LED_START); // indicating application is started LED_Off(LED_NWK_SETUP); // indicating node is associated LED_Off(LED_DATA); // indicating successfull data transmission cpu_irq_enable(); #ifdef SIO_HUB /* Initialize the serial interface used for communication with terminal program. */ sio2host_init(); /* To make sure the hyper terminal gets connected to the system */ sio2host_getchar(); printf("\nNobeacon_Application\r\n\n"); printf("\nDevice\r\n\n"); #endif /* SIO_HUB */ sw_timer_get_id(&APP_TIMER_LED_OFF); sw_timer_get_id(&APP_TIMER_POLL_DATA); wpan_mlme_reset_req(true); while (true) { wpan_task(); } }
/** * Main function, initialization and main message loop * */ int main (void) { irq_initialize_vectors(); /* Initialize the board.ss * The board-specific conf_board.h file contains the configuration of * the board initialization. */ sysclk_init(); board_init(); sw_timer_init(); if (nwk_init()!= NWK_SUCCESS) { app_alert(); } zid_indication_callback_init(); /* * The stack is initialized above, hence the global interrupts are enabled * here. */ cpu_irq_enable(); /* Initializing udc stack as HID composite device*/ udc_start(); sw_timer_get_id(&APP_TIMER); /* Endless while loop */ //udi_hid_gpd_up(16); while (1) { app_task(); /* Application task */ nwk_task(); /* RF4CE network layer task */ } }
/** * \brief Run Wireless Module unit tests * * Initializes the clock system, board and USB. * Then runs the wireless task continuously. */ int main(void) { irq_initialize_vectors(); sysclk_init(); /* Initialize the board. * The board-specific conf_board.h file contains the configuration of * the board initialization. */ board_init(); sw_timer_init(); tal_init(); /* Enable interrupts */ cpu_irq_enable(); stdio_usb_init(); while (1) { tal_task(); } }
/** * Main function, initialization and main message loop * * @return error code */ int main (void) { irq_initialize_vectors(); /* Initialize the board. * The board-specific conf_board.h file contains the configuration of * the board initialization. */ board_init(); sysclk_init(); sw_timer_init(); if (nwk_init() != NWK_SUCCESS) { app_alert(); } zid_indication_callback_init(); cpu_irq_enable(); /* * The global interrupt has to be enabled here as TAL uses the timer * delay which in turn requires interrupt to be enabled */ serial_interface_init(); /* Loop forever, the interrupts are doing the rest */ while (1) { nwk_task(); serial_data_handler(); } /* No return statement here, because this code is unreachable */ }
/** * @brief Main function of the coordinator application * * This function initializes the MAC, initiates a MLME reset request * (@ref wpan_mlme_reset_req()), and implements a the main loop. */ int main(void) { irq_initialize_vectors(); #if SAMD20 system_init(); delay_init(); #else sysclk_init(); /* Initialize the board. * The board-specific conf_board.h file contains the configuration of * the board initialization. */ board_init(); #endif #ifdef SIO_HUB sio2host_init(); #endif sw_timer_init(); if (MAC_SUCCESS != wpan_init()) { app_alert(); } /* Initialize LEDs. */ LED_On(LED_START); /* indicating application is started */ LED_Off(LED_NWK_SETUP); /* indicating network is started */ LED_Off(LED_DATA); /* indicating data transmission */ cpu_irq_enable(); #ifdef SIO_HUB /* Initialize the serial interface used for communication with terminal *program. */ /* To make sure the Hyper Terminal Connected to the system*/ sio2host_getchar(); #ifdef BEACON_SUPPORT printf("\nBeacon_Application\r\n\n"); #else printf("\nNO Beacon_Application\r\n\n"); #endif printf("\nCoordinator\r\n\n"); print_stack_app_build_features(); #endif /* SIO_HUB */ sw_timer_get_id(&APP_TIMER_INDIRECT_DATA); sw_timer_get_id(&APP_TIMER_BCN_PAYLOAD_UPDATE); sw_timer_get_id(&APP_TIMER_BC_DATA); #ifdef GTS_SUPPORT sw_timer_get_id(&APP_TIMER_GTS_DATA); #endif /* * Reset the MAC layer to the default values. * This request will cause a mlme reset confirm message -> * usr_mlme_reset_conf */ wpan_mlme_reset_req(true); #ifdef GPIO_PUSH_BUTTON_0 dst_addr.AddrMode = 2; dst_addr.PANId = DEFAULT_PAN_ID; #endif /* GPIO_PUSH_BUTTON_0 */ while (true) { wpan_task(); #ifdef GPIO_PUSH_BUTTON_0 if (!ioport_get_pin_level(GPIO_PUSH_BUTTON_0)) { delay_ms(DEBOUNCE_DELAY_MS); if (!ioport_get_pin_level(GPIO_PUSH_BUTTON_0)) { dst_addr.Addr.short_address = BROADCAST; wpan_mcps_data_req(FCF_SHORT_ADDR, &dst_addr, strlen(broadcast_payload), (uint8_t *)&broadcast_payload, 1, WPAN_TXOPT_OFF); } } #endif /* GPIO_PUSH_BUTTON_0 */ } }
/** * @brief Main function of the device application */ int main(void) { irq_initialize_vectors(); #if SAMD || SAMR21 system_init(); delay_init(); #else sysclk_init(); /* Initialize the board. * The board-specific conf_board.h file contains the configuration of * the board initialization. */ board_init(); #endif #ifdef SIO_HUB sio2host_init(); #endif sw_timer_init(); if (MAC_SUCCESS != wpan_init()) { app_alert(); } /* Initialize LEDs. */ LED_On(LED_START); /* indicating application is started */ LED_Off(LED_NWK_SETUP); /* indicating network is started */ LED_Off(LED_DATA); /* indicating data transmission */ cpu_irq_enable(); #ifdef SIO_HUB /* Initialize the serial interface used for communication with terminal * program. */ /* To Make sure the Hyper Terminal to the System */ sio2host_getchar(); printf("\nBeacon_Application\r\n\n"); printf("\nDevice\r\n\n"); print_stack_app_build_features(); #endif sw_timer_get_id(&APP_TIMER); wpan_mlme_reset_req(true); #ifdef ENABLE_SLEEP sw_timer_get_id(&APP_TIMER_SLEEP); #endif LED_Off(LED_NWK_SETUP); while (true) { wpan_task(); #if (defined ENABLE_SLEEP || defined RTC_SLEEP) /* Requesting MAC for Sleep Duration*/ sleep_time = mac_ready_to_sleep(); if ((sleep_time > (uint32_t)APP_GUARD_TIME_US)) { /*Entering Power save Mode when the sleep duration is * above the guard time*/ enter_sleep(sleep_time); } #endif } }