/*! \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(); } }
CanSerialDriver::CanSerialDriver(const char* port_name, int baud_rate) { UtilAssert(!is_initialised, "Only one serial driver can be active at once"); serial::Timeout timeout(0, 10, 0, 0, 0); try { serial_port_ = std::make_unique<serial::Serial>(port_name, baud_rate, timeout); read_buffer_index = 0; write_buffer_index = 0; } catch (serial::IOException ex) { serial_port_ = nullptr; } if (serial_port_ != nullptr && serial_port_->isOpen()) { is_initialised = true; s_port = serial_port_.get(); messaging_consumer_init(&messaging_consumer); serial_interface_init(&serial_interface); can_interface_init(&can_interface); writer_thread_ = std::thread(writer_thread); reader_thread_ = std::thread(reader_thread); } }
/** * 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 */ }
/** * 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 */ }