void init_ap( void ) { #ifndef SINGLE_MCU /** init done in main_fbw in single MCU */ mcu_init(); #endif /* SINGLE_MCU */ /************* Sensors initialization ***************/ #if USE_GPS gps_init(); #endif #ifdef USE_GPIO GpioInit(); #endif #if USE_IMU imu_init(); #endif #if USE_AHRS_ALIGNER ahrs_aligner_init(); #endif #if USE_AHRS ahrs_init(); #endif #if USE_BAROMETER baro_init(); #endif ins_init(); stateInit(); /************* Links initialization ***************/ #if defined MCU_SPI_LINK || defined MCU_UART_LINK link_mcu_init(); #endif #if USE_AUDIO_TELEMETRY audio_telemetry_init(); #endif /************ Internal status ***************/ autopilot_init(); h_ctl_init(); v_ctl_init(); nav_init(); modules_init(); settings_init(); /**** start timers for periodic functions *****/ sensors_tid = sys_time_register_timer(1./PERIODIC_FREQUENCY, NULL); navigation_tid = sys_time_register_timer(1./NAVIGATION_FREQUENCY, NULL); attitude_tid = sys_time_register_timer(1./CONTROL_FREQUENCY, NULL); modules_tid = sys_time_register_timer(1./MODULES_FREQUENCY, NULL); telemetry_tid = sys_time_register_timer(1./60, NULL); monitor_tid = sys_time_register_timer(1.0, NULL); /** - start interrupt task */ mcu_int_enable(); #if defined DATALINK #if DATALINK == XBEE xbee_init(); #endif #if DATALINK == W5100 w5100_init(); #endif #endif /* DATALINK */ #if defined AEROCOMM_DATA_PIN IO0DIR |= _BV(AEROCOMM_DATA_PIN); IO0SET = _BV(AEROCOMM_DATA_PIN); #endif /************ Multi-uavs status ***************/ #ifdef TRAFFIC_INFO traffic_info_init(); #endif }
void init_ap( void ) { #ifndef SINGLE_MCU /** init done in main_fbw in single MCU */ mcu_init(); #endif /* SINGLE_MCU */ /****** initialize and reset state interface ********/ stateInit(); /************* Sensors initialization ***************/ #if USE_GPS gps_init(); #endif #if USE_IMU imu_init(); #if USE_IMU_FLOAT imu_float_init(); #endif #endif #if USE_AHRS_ALIGNER ahrs_aligner_init(); #endif #if USE_AHRS ahrs_init(); #endif #if USE_AHRS && USE_IMU register_periodic_telemetry(DefaultPeriodic, "STATE_FILTER_STATUS", send_fliter_status); #endif air_data_init(); #if USE_BARO_BOARD baro_init(); #endif ins_init(); /************* Links initialization ***************/ #if defined MCU_SPI_LINK || defined MCU_UART_LINK link_mcu_init(); #endif #if USE_AUDIO_TELEMETRY audio_telemetry_init(); #endif /************ Internal status ***************/ autopilot_init(); h_ctl_init(); v_ctl_init(); nav_init(); modules_init(); settings_init(); /**** start timers for periodic functions *****/ sensors_tid = sys_time_register_timer(1./PERIODIC_FREQUENCY, NULL); navigation_tid = sys_time_register_timer(1./NAVIGATION_FREQUENCY, NULL); attitude_tid = sys_time_register_timer(1./CONTROL_FREQUENCY, NULL); modules_tid = sys_time_register_timer(1./MODULES_FREQUENCY, NULL); telemetry_tid = sys_time_register_timer(1./TELEMETRY_FREQUENCY, NULL); monitor_tid = sys_time_register_timer(1.0, NULL); /** - start interrupt task */ mcu_int_enable(); #if defined DATALINK #if DATALINK == XBEE xbee_init(); #endif #if DATALINK == W5100 w5100_init(); #endif #endif /* DATALINK */ #if defined AEROCOMM_DATA_PIN IO0DIR |= _BV(AEROCOMM_DATA_PIN); IO0SET = _BV(AEROCOMM_DATA_PIN); #endif /************ Multi-uavs status ***************/ #ifdef TRAFFIC_INFO traffic_info_init(); #endif /* set initial trim values. * these are passed to fbw via inter_mcu. */ ap_state->command_roll_trim = COMMAND_ROLL_TRIM; ap_state->command_pitch_trim = COMMAND_PITCH_TRIM; ap_state->command_yaw_trim = COMMAND_YAW_TRIM; }
void init_ap( void ) { #ifndef SINGLE_MCU /** init done in main_fbw in single MCU */ mcu_init(); sys_time_init(); #endif /* SINGLE_MCU */ /************* Sensors initialization ***************/ #ifdef USE_INFRARED infrared_init(); #endif #ifdef USE_GYRO gyro_init(); #endif #ifdef USE_GPS gps_init(); #endif #ifdef USE_GPIO GpioInit(); #endif #ifdef USE_IMU imu_init(); #endif #ifdef USE_AHRS ahrs_aligner_init(); ahrs_init(); #endif /************* Links initialization ***************/ #if defined MCU_SPI_LINK link_mcu_init(); #endif #ifdef MODEM modem_init(); #endif /************ Internal status ***************/ h_ctl_init(); v_ctl_init(); estimator_init(); #ifdef ALT_KALMAN alt_kalman_init(); #endif nav_init(); modules_init(); settings_init(); /** - start interrupt task */ mcu_int_enable(); /** wait 0.5s (historical :-) */ sys_time_usleep(500000); #if defined GPS_CONFIGURE gps_configure_uart(); #endif #if defined DATALINK #if DATALINK == XBEE xbee_init(); #endif #endif /* DATALINK */ #if defined AEROCOMM_DATA_PIN IO0DIR |= _BV(AEROCOMM_DATA_PIN); IO0SET = _BV(AEROCOMM_DATA_PIN); #endif power_switch = FALSE; /************ Multi-uavs status ***************/ #ifdef TRAFFIC_INFO traffic_info_init(); #endif }
void init_ap( void ) { #ifndef SINGLE_MCU /** init done in main_fbw in single MCU */ hw_init(); sys_time_init(); #ifdef LED led_init(); #endif #ifdef ADC adc_init(); #endif #endif /* SINGLE_MCU */ /************* Sensors initialization ***************/ #ifdef USE_INFRARED ir_init(); #endif #ifdef USE_GYRO gyro_init(); #endif #ifdef USE_GPS gps_init(); #endif #ifdef USE_UART0 Uart0Init(); #endif #ifdef USE_UART1 Uart1Init(); #endif #ifdef USE_UART2 Uart2Init(); #endif #ifdef USE_UART3 Uart3Init(); #endif #ifdef USE_USB_SERIAL VCOM_init(); #endif #ifdef USE_GPIO GpioInit(); #endif #ifdef USE_I2C0 i2c0_init(); #endif #ifdef USE_I2C1 i2c1_init(); #endif #ifdef USE_I2C2 i2c2_init(); #endif /************* Links initialization ***************/ #if defined USE_SPI spi_init(); #endif #if defined MCU_SPI_LINK link_mcu_init(); #endif #ifdef MODEM modem_init(); #endif /************ Internal status ***************/ h_ctl_init(); v_ctl_init(); estimator_init(); #ifdef ALT_KALMAN alt_kalman_init(); #endif nav_init(); modules_init(); /** - start interrupt task */ int_enable(); /** wait 0.5s (historical :-) */ sys_time_usleep(500000); #if defined GPS_CONFIGURE gps_configure_uart(); #endif #if defined DATALINK #if DATALINK == XBEE xbee_init(); #endif #endif /* DATALINK */ #if defined AEROCOMM_DATA_PIN IO0DIR |= _BV(AEROCOMM_DATA_PIN); IO0SET = _BV(AEROCOMM_DATA_PIN); #endif power_switch = FALSE; /************ Multi-uavs status ***************/ #ifdef TRAFFIC_INFO traffic_info_init(); #endif }