static inline void main_init(void)
{
  mcu_init();
  sys_time_register_timer((1. / PERIODIC_FREQUENCY), NULL);

  stateInit();
  actuators_init();

  imu_init();
#if USE_AHRS_ALIGNER
  ahrs_aligner_init();
#endif
  ahrs_init();

  settings_init();

  mcu_int_enable();

  downlink_init();

  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_AUTOPILOT_VERSION, send_autopilot_version);
  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_ALIVE, send_alive);
  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_COMMANDS, send_commands);
  register_periodic_telemetry(DefaultPeriodic, PPRZ_MSG_ID_ACTUATORS, send_actuators);

  // send body_to_imu from here for now
  AbiSendMsgBODY_TO_IMU_QUAT(1, orientationGetQuat_f(&imu.body_to_imu));
}
Beispiel #2
0
/**
 * Initialise non-volatile stored options
 *
 * @v nvo		Non-volatile options block
 * @v nvs		Underlying non-volatile storage device
 * @v fragments		List of option-containing fragments
 * @v refcnt		Containing object reference counter, or NULL
 */
void nvo_init ( struct nvo_block *nvo, struct nvs_device *nvs,
		struct nvo_fragment *fragments, struct refcnt *refcnt ) {
	nvo->nvs = nvs;
	nvo->fragments = fragments;
	settings_init ( &nvo->settings, &nvo_settings_operations, refcnt,
			"nvo", 0 );
}
Beispiel #3
0
void settings_menu_push(state_stack* stack, void* udata) {
	(void) udata;
	state_desc mm = {
		GAME_SETTINGS_MENU, nullptr,
		nullptr, nullptr,
		&_event,
		nullptr,
		&_draw,
		&_destroy,
		nullptr, nullptr, false,
	};
	
	_settings_menu *data = (_settings_menu*) malloc(sizeof(_settings_menu));
	
	menu *pMenu = menu_init(100, 50);
	menu_add_entry(pMenu, "Controls");
	menu_add_entry(pMenu, "");
	menu_add_entry(pMenu, STR_ARROWBIG_LEFT " Save Settings");
	menu_add_entry(pMenu, STR_ARROWBIG_LEFT " Discard Changes");
	menu_auto_resize(pMenu);
	data->m_menu = pMenu;
	
	data->m_settings = settings_init();
	input_config_settings(data->m_settings, g_keybinds);
	screen_config_settings(data->m_settings, nullptr);
	settings_load(data->m_settings, settings_file_path);
	
	mm.m_pData = data;
	table_append(stack, &mm);
}
Beispiel #4
0
/*
 * Main entry point
 */
int
main(int argc ,char **argv)
{
    int             ret;

    /* first, init time */
    tc_time_update();

    /* Set defaults */
    settings_init();
    read_args(argc, argv);
    /* Init log for outputing debug info */
    log_init(clt_settings.log_path);
    /* Output debug info */
    output_for_debug(argc, argv);
    /* Set details for running */
    set_details();

    ret = tc_event_loop_init(&event_loop, MAX_FD_NUM);
    if (ret == TC_EVENT_ERROR) {
        log_info(LOG_ERR, "event loop init failed");
        return -1;
    }

    /* Initiate tcpcopy client*/
    ret = tcp_copy_init(&event_loop);
    if (SUCCESS != ret) {
        exit(EXIT_FAILURE);
    }

    /* Run now */
    tc_event_process_cycle(&event_loop);

    return 0;
}
Beispiel #5
0
int
main(int argc, char **argv)
{
    int ret;

    settings_init();

    if (set_signal_handler(signals) == -1) {
        return -1;
    }

    tc_time_init();

    if (read_args(argc, argv) == -1) {
        return -1;
    }

    if (srv_settings.log_path == NULL) {
        srv_settings.log_path = "error_intercept.log";  
    }

    if (tc_log_init(srv_settings.log_path) == -1) {
        return -1;
    }

    ret = tc_event_loop_init(&s_event_loop, MAX_FD_NUM);
    if (ret == TC_EVENT_ERROR) {
        tc_log_info(LOG_ERR, 0, "event loop init failed");
        return -1;
    }

    /* output debug info */
    output_for_debug();
    if (set_details() == -1) {
        return -1;
    }

    if (interception_init(&s_event_loop, srv_settings.binded_ip,
                          srv_settings.port) == TC_ERROR)
    {
        return -1;
    }

    if (set_timer() == -1) {
        return -1;
    }

#if (INTERCEPT_COMBINED)
    tc_event_timer_add(&s_event_loop, CHECK_INTERVAL, interception_push);
#endif
    tc_event_timer_add(&s_event_loop, OUTPUT_INTERVAL,
            interception_output_stat);

    /* run now */
    tc_event_process_cycle(&s_event_loop);

    server_release_resources();

    return 0;
}
Beispiel #6
0
void core_init(void)
{
	modules_init();
#ifndef WIN32
	pidwait_init();
#endif

	net_disconnect_init();
	net_sendbuffer_init();
	signals_init();
	settings_init();
	commands_init();
        nickmatch_cache_init();

	chat_protocols_init();
	chatnets_init();
        expandos_init();
	ignore_init();
	servers_init();
        write_buffer_init();
	log_init();
	rawlog_init();

	channels_init();
	queries_init();
	nicklist_init();

	chat_commands_init();
        settings_check();
}
Beispiel #7
0
static void
init_settings(void)
{
    settings_init();
    settings_load();
    
    hotkey_t hk;
    settings_get(TRIGGER_KEY, &hk);
    INIT_KEY_SETTING(trigger);

    settings_get(ENG_KEY, &hk);
    INIT_KEY_SETTING(english);

    varchar colorstr;
    settings_get(PREEDIT_COLOR, colorstr);
    INIT_COLOR_SETTING(background_color_btn);

    settings_get(PREEDIT_FONT_COLOR, colorstr);
    INIT_COLOR_SETTING(font_color_btn);

    varchar fontstr;
    settings_get(PREEDIT_FONT, fontstr);
    gtk_font_button_set_font_name(font_btn, fontstr);

    double scale;
    settings_get(PREEDIT_OPACITY, &scale);
    gtk_adjustment_set_value(opacity_value, scale);

    int ncandi;
    settings_get(CANDIDATES_SIZE, &ncandi);
    gtk_adjustment_set_value(ncandidates, ncandi);
}
Beispiel #8
0
STATIC_INLINE void main_init( void ) {

  mcu_init();

  electrical_init();

  stateInit();

  actuators_init();
#if USE_MOTOR_MIXING
  motor_mixing_init();
#endif

  radio_control_init();

  air_data_init();
#if USE_BARO_BOARD
  baro_init();
#endif
  imu_init();
#if USE_IMU_FLOAT
  imu_float_init();
#endif
  ahrs_aligner_init();
  ahrs_init();

  ins_init();

#if USE_GPS
  gps_init();
#endif

  autopilot_init();

  modules_init();

  settings_init();

  mcu_int_enable();

#if DATALINK == XBEE
  xbee_init();
#endif

#if DATALINK == UDP
  udp_init();
#endif

  // register the timers for the periodic functions
  main_periodic_tid = sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
  modules_tid = sys_time_register_timer(1./MODULES_FREQUENCY, NULL);
  radio_control_tid = sys_time_register_timer((1./60.), NULL);
  failsafe_tid = sys_time_register_timer(0.05, NULL);
  electrical_tid = sys_time_register_timer(0.1, NULL);
  telemetry_tid = sys_time_register_timer((1./TELEMETRY_FREQUENCY), NULL);
#if USE_BARO_BOARD
  baro_tid = sys_time_register_timer(1./BARO_PERIODIC_FREQUENCY, NULL);
#endif
}
Beispiel #9
0
STATIC_INLINE void main_init( void ) {

  mcu_init();

  electrical_init();

  stateInit();

  actuators_init();
#if USE_MOTOR_MIXING
 // motor_mixing_init();
 // servo_mixing_init();
  set_servo_init();
#endif

  radio_control_init();

  baro_init();
  imu_init();
  autopilot_init();
  nav_init();
  guidance_h_init();
  guidance_v_init();
  stabilization_init();

  ahrs_aligner_init();
  ahrs_init();

  ins_init();

#if USE_GPS
  gps_init();
#endif

  modules_init();

  settings_init();

  mcu_int_enable();

#if DATALINK == XBEE
  xbee_init();
#endif

#if DATALINK == UDP
  udp_init();
#endif

  // register the timers for the periodic functions
  main_periodic_tid = sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
  modules_tid = sys_time_register_timer(1./MODULES_FREQUENCY, NULL);
  radio_control_tid = sys_time_register_timer((1./60.), NULL);
  failsafe_tid = sys_time_register_timer(0.05, NULL);
  electrical_tid = sys_time_register_timer(0.1, NULL);
  baro_tid = sys_time_register_timer(1./BARO_PERIODIC_FREQUENCY, NULL);
  telemetry_tid = sys_time_register_timer((1./TELEMETRY_FREQUENCY), NULL);
}
Beispiel #10
0
int settings_write_defaults(const char *path) {
    int r = 0;
    settings_init(path);
    if(conf_write_config(path)) {
        r = 1;
    }
    settings_free();
    return r;
}
Beispiel #11
0
static inline void main_init( void ) {

  mcu_init();
  sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
  settings_init();

  mcu_int_enable();

}
Beispiel #12
0
Datei: rqd.c Projekt: hyper/rqd
// init settings
static void init_settings(system_data_t *sysdata)
{
	assert(sysdata);
	assert(sysdata->settings == NULL);
	
	sysdata->settings = (settings_t *) malloc(sizeof(settings_t));
	assert(sysdata->settings);
	settings_init(sysdata->settings);
}
Beispiel #13
0
/*The Main Program*/
int main(int argc, char** argv) {
    /* defines the tray_icon, as well as init gtk*/
    g_set_application_name(PACKAGE_NAME);
    parse_command_line_options(argc,argv);
    register_thread("Main Thread");
    if (!queue_init())
        print("queue_init FAILED",NULL,ERROR);
    print("Glade File",glade_file,DEBUG);
    g_thread_init(NULL);
    gtk_init(NULL,NULL);
    gtk_init(&argc, &argv);
    Hosts_lock = g_mutex_new();
    Userpath_lock = g_mutex_new();
    g_mutex_lock(Userpath_lock);
    Userpath = g_strdup(getenv("HOME"));
    g_mutex_unlock(Userpath_lock);

    settings_init();
    rest_init();
    if (!xml_init())
        print("xml_init FAILED",NULL,ERROR);
    init_hostname();
    /*sets the tray icon from the create_tray_icon*/
    create_tray_icon();
    playing_info_music pInfo = {"Artist","Album","Song",0,0,0};
    /* declares the playing info struct, and print if, if _DEBUG is definded at the top of msdaemon.c*/
    /*inits the dbus and get the first set of info*/
    dbus_init();
    pInfo = dbus_get_playing_info_music();
    print_playing_info_music(pInfo);
    get_active_devices(NULL);
    update_song_info();
    GError *error;
    if ( (network_thread = g_thread_create((GThreadFunc)rest_thread_handler, NULL, FALSE, &error)) == NULL){
        print("Error Creating Network Thread",error->message,ERROR);
        g_error_free(error);
    }

    if ( (file_thread = g_thread_create((GThreadFunc)file_thread_handler, NULL, FALSE, &error)) == NULL){
        print("Error Creating Network Thread",error->message,ERROR);
        g_error_free(error);
    }
    if ( (gui_thread = g_thread_create((GThreadFunc)gui_thread_handler, NULL, FALSE, &error)) == NULL){
        print("Error Creating Network Thread",error->message,ERROR);
        g_error_free(error);
    }

    g_timeout_add (1000,(GSourceFunc) get_next_command,NULL);
    g_timeout_add (300000,(GSourceFunc) update_active_devices,NULL);
    init_status_window(FALSE,glade_file);
    start_tray();
    g_free(Userpath);

    deauthenticate();
    return 0;
}
Beispiel #14
0
int main(void)
{
  // Initialize system upon power-up.
  serial_init();   // Setup serial baud rate and interrupts
  settings_init(); // Load grbl settings from EEPROM
  stepper_init();  // Configure stepper pins and interrupt timers
  system_init();   // Configure pinout pins and pin-change interrupt
  
  memset(&sys, 0, sizeof(sys));  // Clear all system variables
  sys.abort = true;   // Set abort to complete initialization
  sei(); // Enable interrupts

  // Check for power-up and set system alarm if homing is enabled to force homing cycle
  // by setting Grbl's alarm state. Alarm locks out all g-code commands, including the
  // startup scripts, but allows access to settings and internal commands. Only a homing
  // cycle '$H' or kill alarm locks '$X' will disable the alarm.
  // NOTE: The startup script will run after successful completion of the homing cycle, but
  // not after disabling the alarm locks. Prevents motion startup blocks from crashing into
  // things uncontrollably. Very bad.
  #ifdef HOMING_INIT_LOCK
    if (bit_istrue(settings.flags,BITFLAG_HOMING_ENABLE)) { sys.state = STATE_ALARM; }
  #endif
  
  // Grbl initialization loop upon power-up or a system abort. For the latter, all processes
  // will return to this loop to be cleanly re-initialized.
  for(;;) {

    // TODO: Separate configure task that require interrupts to be disabled, especially upon
    // a system abort and ensuring any active interrupts are cleanly reset.
  
    // Reset Grbl primary systems.
    serial_reset_read_buffer(); // Clear serial read buffer
    gc_init(); // Set g-code parser to default state
    spindle_init();
    coolant_init();
    limits_init(); 
    probe_init();
    plan_reset(); // Clear block buffer and planner variables
    st_reset(); // Clear stepper subsystem variables.

    // Sync cleared gcode and planner positions to current system position.
    plan_sync_position();
    gc_sync_position();

    // Reset system variables.
    sys.abort = false;
    sys.execute = 0;
    if (bit_istrue(settings.flags,BITFLAG_AUTO_START)) { sys.auto_start = true; }
    else { sys.auto_start = false; }
          
    // Start Grbl main loop. Processes program inputs and executes them.
    protocol_main_loop();
    
  }
  return 0;   /* Never reached */
}
Beispiel #15
0
void core_init(void)
{
	dialog_type_queue = NULL;
	dialog_text_queue = NULL;
	client_start_time = time(NULL);

	modules_init();
	pidwait_init();

	net_disconnect_init();
	signals_init();

	signal_add_first("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
	signal_add_first("irssi init finished", (SIGNAL_FUNC) sig_init_finished);

	settings_init();
	commands_init();
	nickmatch_cache_init();
        session_init();
#ifdef HAVE_CAPSICUM
	capsicum_init();
#endif

	chat_protocols_init();
	chatnets_init();
        expandos_init();
	ignore_init();
	servers_init();
        write_buffer_init();
	log_init();
	log_away_init();
	rawlog_init();
	recode_init();

	channels_init();
	queries_init();
	nicklist_init();

	chat_commands_init();
	wcwidth_wrapper_init();

	settings_add_str("misc", "ignore_signals", "");
	settings_add_bool("misc", "override_coredump_limit", FALSE);

#ifdef HAVE_SYS_RESOURCE_H
	getrlimit(RLIMIT_CORE, &orig_core_rlimit);
#endif
	read_settings();
	signal_add("setup changed", (SIGNAL_FUNC) read_settings);
	signal_add("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);

	settings_check();

        module_register("core", "core");
}
static void menu_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) {
  if (cell_index->row == GAME_INDEX) {
    chess_init();
  } else if (cell_index->row == INSTRUCTION_INDEX) {
    text_init(CHESS);
  } else if (cell_index->row == SETTINGS_INDEX) {
    settings_init();
  } else if (cell_index->row == ABOUT_INDEX) {
    text_init(ABOUT);
  }
}
Beispiel #17
0
int main(int argc, char *argv[])
{
    enum { SC = 3 };
    int opt, n;
    int sigs[] = { SIGINT, SIGHUP, SIGTERM };
    void (*sighandlers[])() = { sigint_handler,
                                sighup_handler,
                                sigterm_handler };
    struct sigaction s[SC];

    for (n = 0; n < SC; ++n)
    {
        s[n].sa_handler = SIG_IGN;
        sigfillset(&s[n].sa_mask);
        s[n].sa_flags = 0;
        sigaction(sigs[n], &s[n], NULL);
    }

    for (opt = 1; opt < argc; ++opt)
    {
        if (strcmp(argv[opt], "-h") == 0
         || strcmp(argv[opt], "--help") == 0)
        {
            show_usage();
            return 0;
        }
    }

    mod_src_create();
    gtk_init(&argc, &argv);
    settings_init();
    driver_init();
    lfo_tables_init();
    mixer_init();
    patch_control_init();
    dish_file_state_init();
    session_init(argc, argv);
    gui_init();

    for (n = 0; n < SC; ++n)
    {
        s[n].sa_handler = sighandlers[n];
        sigfillset(&s[n].sa_mask);
        s[n].sa_flags = 0;
        sigaction(sigs[n], &s[n], NULL);
    }

    gtk_main();

    cleanup();

    return 0;
}
Beispiel #18
0
void config_init() {
    logprintf(LOG_STACK, "%s(...)", __FUNCTION__);

    hardware_init();
    settings_init();
    devices_init();
    gui_init();
#ifdef EVENTS
    rules_init();
#endif
    registry_init();
}
Beispiel #19
0
void core_init(int argc, char *argv[])
{
	dialog_type_queue = NULL;
	dialog_text_queue = NULL;

	modules_init();
#ifndef WIN32
	pidwait_init();
#endif

	net_disconnect_init();
	net_sendbuffer_init();
	signals_init();

	signal_add_first("gui dialog", (SIGNAL_FUNC) sig_gui_dialog);
	signal_add_first("irssi init finished", (SIGNAL_FUNC) sig_init_finished);

	settings_init();
	commands_init();
	nickmatch_cache_init();
        session_init();

	chat_protocols_init();
	chatnets_init();
        expandos_init();
	ignore_init();
	servers_init();
        write_buffer_init();
	log_init();
	log_away_init();
	rawlog_init();
	recode_init();

	channels_init();
	queries_init();
	nicklist_init();

	chat_commands_init();

	settings_add_str("misc", "ignore_signals", "");
	settings_add_bool("misc", "override_coredump_limit", TRUE);

#ifdef HAVE_SYS_RESOURCE_H
	getrlimit(RLIMIT_CORE, &orig_core_rlimit);
#endif
	read_settings();
	signal_add("setup changed", (SIGNAL_FUNC) read_settings);
	signal_add("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);

	settings_check();

        module_register("core", "core");
}
Beispiel #20
0
int main(int argc, char **argv) {

  int c;

  settings_init();

  while (-1 != (c = getopt(argc, argv,
          "h:"
          "i:"
          "p:"
          "m:"
          "c:"
          "n:"
          "b:"
          "s"
          "v"
          ))) {
    switch (c) {
      case 'h':
        usage();
        exit(EXIT_SUCCESS);
      case 'i':
        settings.host = optarg;
        break;
      case 'p':
        settings.port = atoi(optarg);
        break;
      case 'm':
        settings.message = optarg;
        break;
      case 'c':
        settings.count = atol(optarg);
        break;
      case 'n':
        settings.no_of_threads= atoi(optarg);
        break;
      case 'b':
        settings.bufsize = atoi(optarg);
        break;
      case 's':
        settings.sctp = true;
        break;
      case 'v':
        settings.verbose = true;
        break;
      default:
        fprintf(stderr, "Illegal argument \"%c\"\n", c);
        exit(EXIT_FAILURE);
    }
  }
  echoClient(settings.host, settings.port, settings.message, settings.count, settings.no_of_threads);
}
Beispiel #21
0
void handle_init(void) {
    status_bar_init();
#ifdef PBL_ROUND
    round_bottom_bar_init();
#endif
    settings_init();
    locale_init();
    stations_init();
    favorites_init();
    message_init();
    
    ui_push_window(new_window_main_menu());
}
Beispiel #22
0
static inline void main_init( void ) {

  mcu_init();
  sys_time_init();
  settings_init();
  //  DEBUG_SERVO2_INIT();
  //  LED_ON(1);
  //  LED_ON(2);
  //  DEBUG_S4_ON();
  //  DEBUG_S5_ON();
  //  DEBUG_S6_ON();
  mcu_int_enable();

}
Beispiel #23
0
static inline void main_init( void ) {

  mcu_init();
  sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
  settings_init();
  //  DEBUG_SERVO2_INIT();
  //  LED_ON(1);
  //  LED_ON(2);
  //  DEBUG_S4_ON();
  //  DEBUG_S5_ON();
  //  DEBUG_S6_ON();
  mcu_int_enable();

}
Beispiel #24
0
int main(void)
{
    sp_init();
    settings_init();
    plan_init();
    st_init();
    spindle_init();
    gc_init();

    for (;;) {
	sleep_mode();		// Wait for it ...
	sp_process();		// ... process the serial protocol
    }
    return 0;			/* never reached */
}
Beispiel #25
0
void core_init(void)
{
	modules_init();
	pidwait_init();

	net_disconnect_init();
	signals_init();
	settings_init();
	commands_init();

	servers_init();
	log_init();
	rawlog_init();
	special_vars_init();
}
Beispiel #26
0
//------------------------------------------------------------------------------
void* initialise_clink_settings()
{
    char settings_file[MAX_PATH];

    get_settings_file(settings_file, sizeof_array(settings_file));

    g_settings = settings_init(g_settings_decl, sizeof_array(g_settings_decl));

    if (!settings_load(g_settings, settings_file))
    {
        settings_save(g_settings, settings_file);
    }

    return g_settings;
}
Beispiel #27
0
int 
main(int argc, char* argv[])
{
    if (argc == 2 && strcmp(argv[1], "-d") == 0) {
        int pid = fork();
        if (pid < 0)
            return -1;
        else if (pid > 0)
            return 0;
    }
    
    init_display(&argc, &argv);
    XSetErrorHandler (_xerror_handler);
    preedit_init();

    settings_init();
    settings_load();

    /* check if the codeset is utf-8 */
    if (strcmp(nl_langinfo(CODESET), "UTF-8") != 0) {
        printf("Can't use xim server with codeset %s.\n",
               nl_langinfo(CODESET));
        return -1;
    }

    /* guess the locale */
    char* locale = getenv("LC_CTYPE");
    if (locale == NULL) {
        locale = getenv("LANG");
        if (locale == NULL) {
            printf("Can't guess locale.\n");
            return -1;
        }
    }
    
    XIMHandle* hdl = create_xim_server(XIM_NAME, locale);
    preedit_set_handle(hdl);
    preedit_reload();

    signal(SIGUSR1, on_app_sig);
    signal(SIGHUP, on_app_sig);
    signal(SIGINT, on_app_sig);
    signal(SIGTERM, on_app_sig);

    gtk_main();
    
    return 0;
}
Beispiel #28
0
/*
 * main entry point
 */
int
main(int argc, char **argv)
{
    int ret;

    settings_init();

    tc_time_init();

    if (read_args(argc, argv) == -1) {
        return -1;
    }
    
    if (clt_settings.log_path == NULL) {
        clt_settings.log_path = "error_tcpcopy.log";
    }   

    if (tc_log_init(clt_settings.log_path) == -1) {
        return -1;
    }

    /* output debug info */
    output_for_debug(argc, argv);

    /* set details for running */
    if (set_details() == -1) {
        return -1;
    }

    ret = tc_event_loop_init(&event_loop, MAX_FD_NUM);
    if (ret == TC_EVENT_ERROR) {
        tc_log_info(LOG_ERR, 0, "event loop init failed");
        return -1;
    }

    ret = tcp_copy_init(&event_loop);
    if (ret == TC_ERROR) {
        exit(EXIT_FAILURE);
    }

    /* run now */
    tc_event_process_cycle(&event_loop);

    tcp_copy_release_resources();

    return 0;
}
Beispiel #29
0
STATIC_INLINE void main_init( void ) {

#ifndef NO_FUCKING_STARTUP_DELAY
#ifndef RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT
  /* IF THIS IS NEEDED SOME PERHIPHERAL THEN PLEASE MOVE IT THERE */
  for (uint32_t startup_counter=0; startup_counter<2000000; startup_counter++){
    __asm("nop");
  }
#endif
#endif

  mcu_init();

  sys_time_init();
  electrical_init();

  actuators_init();
  radio_control_init();

#if DATALINK == XBEE
  xbee_init();
#endif

  baro_init();
  imu_init();
  autopilot_init();
  nav_init();
  guidance_h_init();
  guidance_v_init();
  stabilization_init();

  ahrs_aligner_init();
  ahrs_init();

  ins_init();

#ifdef USE_GPS
  gps_init();
#endif

  modules_init();

  settings_init();

  mcu_int_enable();

}
Beispiel #30
0
int main(void)
{
    main_init();
    timer_a0_init();

    // PGA2311 needs to get the digital power after a delay
    // otherwise it will lock up
    timer_a0_delay_ccr4(_1s);
    pga_enable;
    spi_init();
    spi_fast_mode();

    // set chip selects high (deselect all slaves)
    P1OUT |= 0x54;
    P2OUT |= 0x1;
    P4OUT |= 0x84;

    settings_init(FLASH_ADDR);

    get_temperature();

#ifdef USE_UART
    uart1_init();
    uart1_iface_init();
#endif

#ifdef USE_I2C
    i2c_slave_init();
    i2c_iface_init();
#endif

    sys_messagebus_register(&timer_a0_ovf_irq, SYS_MSG_TIMER0_IFG);

    led_off;

    while (1) {
        // go into low power mode until an IRQ wakes us up
        _BIS_SR(LPM0_bits + GIE);
        __no_operation();
        //wake_up();
#ifdef USE_WATCHDOG
        WDTCTL = (WDTCTL & 0xff) | WDTPW | WDTCNTCL;
#endif
        check_events();
    }
}