Esempio n. 1
0
int bebopr_pre_init( void)
{
  int result = -1;

  result = analog_config( analog_config_data, NR_ITEMS( analog_config_data));
  if (result < 0) {
    fprintf( stderr, "analog_config failed!\n");
    goto done;
  }
  result = temp_config( temp_config_data, NR_ITEMS( temp_config_data));
  if (result < 0) {
    fprintf( stderr, "temp_config failed!\n");
    goto done;
  }
  result = pwm_config( pwm_config_data, NR_ITEMS( pwm_config_data));
  if (result < 0) {
    fprintf( stderr, "pwm_config failed!\n");
    goto done;
  }
  result = heater_config( heater_config_data, NR_ITEMS( heater_config_data));
  if (result < 0) {
    fprintf( stderr, "heater_config failed!\n");
    goto done;
  }
  result = get_step_io_config( EEPROM_PATH);
  // Only differentiate between Pololu and TB6560, default to Pololu
  if (result == TB6560_DRIVERS) {
    use_pololu_drivers = 0;
  }
  fprintf( stderr, "Using stepper driver configuration: '%s'\n", (use_pololu_drivers) ? "Pololu" : "TB6560");
  result = 0;
 done:
  return result;
}
Esempio n. 2
0
/*
 * Setup all sub sys of unicorn
 */
static int unicorn_setup()
{
    int ret = 0; 

    if (bbp_board_type == BOARD_BBP1) {
        printf("Board is FastBot BBP 1\n");
        ret = analog_config(analog_config_bbp1, NR_ITEMS(analog_config_bbp1));
        if (ret < 0) {
            printf("analog_config failed\n");
            goto out;
        }

        ret = temp_config(temp_config_data_bbp1, NR_ITEMS(temp_config_data_bbp1));
        if (ret < 0) {
            printf("temp_config failed\n");
            goto out;
        }

        ret = pwm_config(pwm_config_bbp1, NR_ITEMS(pwm_config_bbp1));
        if (ret < 0) {
            printf("pwm_config failed\n");
            goto out;
        }
        
        ret = fan_config(fan_config_bbp1, NR_ITEMS(fan_config_bbp1));
        if (ret < 0) {
            printf("fan_config failed\n");
            goto out;
        }

        ret = heater_config(heater_config_data_bbp, NR_ITEMS(heater_config_data_bbp));
        if (ret < 0) {
            printf("heater_config failed\n");
            goto out;
        }

        ret = stepper_config(stepper_config_bbp1, NR_ITEMS(stepper_config_bbp1));
        if (ret < 0) {
            printf("stepper_config failed\n");
            goto out;
        }
    } else if (bbp_board_type == BOARD_BBP1S) {
        printf("Board is FastBot BBP 1s\n");
        ret = analog_config(analog_config_bbp1s, NR_ITEMS(analog_config_bbp1s));
        if (ret < 0) {
            printf("analog_config failed\n");
            goto out;
        }

        ret = temp_config(temp_config_data_bbp1s, NR_ITEMS(temp_config_data_bbp1s));
        if (ret < 0) {
            printf("temp_config failed\n");
            goto out;
        }

        ret = pwm_config(pwm_config_bbp1s, NR_ITEMS(pwm_config_bbp1s));
        if (ret < 0) {
            printf("pwm_config failed\n");
            goto out;
        }
        
        ret = fan_config(fan_config_bbp1s, NR_ITEMS(fan_config_bbp1s));
        if (ret < 0) {
            printf("fan_config failed\n");
            goto out;
        }

        ret = heater_config(heater_config_data_bbp1s, NR_ITEMS(heater_config_data_bbp1s));
        if (ret < 0) {
            printf("heater_config failed\n");
            goto out;
        }

#ifdef SERVO
		if (bbp_board_type == BOARD_BBP1S) {
			ret = servo_config(servo_config_data, NR_ITEMS(servo_config_data));
			if (ret < 0) {
				printf("servo_config failed\n");
				goto out;
			}
		}
#endif

        ret = stepper_config(stepper_config_bbp1s, NR_ITEMS(stepper_config_bbp1s));
        if (ret < 0) {
            printf("stepper_config failed\n");
            goto out;
        }
    } else {
        printf("Not supported board!\n");
    }
out:
    return ret;
}