/*! \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(); } }
/** * \brief Performs a Reset check on AT86RFx module * * This function will simply test the output of the function * \ref wpan_mlme_reset_req and returns an error in case of failure. * * \param test Current test case. */ static void run_wpan_reset_test(const struct test_case *test) { wpan_mlme_reset_req(true); while (!wpan_reset_conf_rcvd) { wpan_task(); } test_assert_true(test, wpan_reset_conf_status == MAC_SUCCESS, "AVR2025_MAC - MAC Reset request failed"); }
static void run_wpan_scan_test(const struct test_case *test) { wpan_mlme_scan_req(MLME_SCAN_TYPE_ACTIVE, SCAN_CHANNEL, SCAN_DURATION, DEFAULT_CHANNEL_PAGE); while (!wpan_scan_conf_rcvd) { wpan_task(); } test_assert_true(test, (wpan_scan_conf_status == MAC_SUCCESS) || (wpan_scan_conf_status == MAC_NO_BEACON), "AVR2025_MAC - MAC Scan test failed"); }
/*! \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 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(); } }
/** * \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(); wpan_init(); /* Enable interrupts */ cpu_irq_enable(); stdio_usb_init(); while (1) { wpan_task(); } }
/** * @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 } }