Example #1
0
int epos_input_set_channel_func(epos_input_p input, int channel, 
  epos_input_func_type_t type) {
  int result = EPOS_DEVICE_ERROR_NONE;
  short t = EPOS_INPUT_RESERVED_FUNC;
  int enabled = input->funcs[type].enabled;

  if (input->funcs[type].channel) {
    if (!(result = epos_device_write(input->dev, EPOS_INPUT_INDEX_CONFIG, 
      input->funcs[type].channel, (unsigned char*)&t, sizeof(short)))) {
      input->channels[input->funcs[type].channel-1] = EPOS_INPUT_DUMMY_FUNC;
      input->funcs[type].channel = 0;
    }
    else
      return result;
  }

  if (channel) {
    t = type;

    if (!(result = epos_device_write(input->dev, EPOS_INPUT_INDEX_CONFIG, 
      channel, (unsigned char*)&t, sizeof(short)))) {
      input->channels[channel-1] = type;
      input->funcs[type].channel = channel;
    }
  }

  return result;
}
Example #2
0
int epos_position_profile_set_velocity(epos_device_t* dev, unsigned int
    velocity) {
  return epos_device_write(dev, EPOS_POSITION_PROFILE_INDEX_VELOCITY, 0,
    (unsigned char*)&velocity, sizeof(unsigned int));
  
  return dev->error.code;
}
Example #3
0
int epos_sensor_set_pulses(epos_sensor_t* sensor, int num_pulses) {
  if (sensor->dev->hardware_generation == 1) {
    short pulses_short = num_pulses;;    
    epos_device_write(sensor->dev, EPOS_SENSOR_INDEX_CONFIGURATION,
      EPOS_SENSOR_SUBINDEX_PULSES, (unsigned char*)&pulses_short,
      sizeof(short));
  }
  else
    epos_device_write(sensor->dev, EPOS_SENSOR_INDEX_CONFIGURATION,
      EPOS_SENSOR_SUBINDEX_PULSES, (unsigned char*)&num_pulses, sizeof(int));

  if (!sensor->dev->error.code)
    sensor->num_pulses = num_pulses;

  return sensor->dev->error.code;
}
Example #4
0
int epos_home_set_acceleration(epos_device_t* dev, unsigned int
    acceleration) {
  epos_device_write(dev, EPOS_HOME_INDEX_ACCELERATION, 0,
    (unsigned char*)&acceleration, sizeof(unsigned int));
  
  return dev->error.code;
}
Example #5
0
int epos_home_set_zero_search_velocity(epos_device_t* dev, unsigned int
    velocity) {
  epos_device_write(dev, EPOS_HOME_INDEX_VELOCITIES,
    EPOS_HOME_SUBINDEX_ZERO_SEARCH_VELOCITY, (unsigned char*)&velocity,
    sizeof(unsigned int));
  
  return dev->error.code;
}
Example #6
0
int epos_sensor_set_type(epos_sensor_t* sensor, epos_sensor_type_t type) {
  if (epos_device_write(sensor->dev, EPOS_SENSOR_INDEX_CONFIGURATION,
      EPOS_SENSOR_SUBINDEX_TYPE, (unsigned char*)&epos_sensor_types[type],
      sizeof(short)) > 0)
    sensor->type = type;

  return sensor->dev->error.code;
}
Example #7
0
int epos_sensor_set_polarity(epos_sensor_t* sensor, epos_sensor_polarity_t
    polarity) {
  if (epos_device_write(sensor->dev, EPOS_SENSOR_INDEX_CONFIGURATION,
      EPOS_SENSOR_SUBINDEX_POLARITY,
      (unsigned char*)&epos_sensor_polarities[polarity], sizeof(short)) > 0)
    sensor->polarity = polarity;

  return sensor->dev->error.code;
}
Example #8
0
int epos_input_set_enabled(epos_input_p input, short enabled) {
  int result;

  if (!(result = epos_device_write(input->dev, EPOS_INPUT_INDEX_FUNCS, 
    EPOS_INPUT_SUBINDEX_MASK, (unsigned char*)&enabled, sizeof(short))))
    input->enabled = enabled;

  return result;
}
Example #9
0
int epos_input_set_execute(epos_input_p input, short execute) {
  int result;

  if (!(result = epos_device_write(input->dev, EPOS_INPUT_INDEX_FUNCS, 
    EPOS_INPUT_SUBINDEX_EXECUTE, (unsigned char*)&execute, sizeof(short))))
    input->execute = execute;

  return result;
}
Example #10
0
int epos_input_set_polarity(epos_input_p input, short polarity) {
  int result;

  if (!(result = epos_device_write(input->dev, EPOS_INPUT_INDEX_FUNCS, 
    EPOS_INPUT_SUBINDEX_POLARITY, (unsigned char*)&polarity, sizeof(short))))
    input->polarity = polarity;

  return result;
}
Example #11
0
int epos_control_set_type(epos_control_p control, epos_control_type_t type) {
  char t = type;
  int result = epos_device_write(control->dev, EPOS_CONTROL_INDEX_MODE, 0,
    &t, 1);

  if (!result)
    control->type = type;

  return result;
}
Example #12
0
int epos_home_set_method(epos_device_t* dev, epos_home_method_t method) {
  epos_device_write(dev, EPOS_HOME_INDEX_METHOD, 0,
    (unsigned char*)&epos_home_methods[method], 1);
  
  return dev->error.code;
}
Example #13
0
int epos_home_set_position(epos_device_t* dev, int position) {
  epos_device_write(dev, EPOS_HOME_INDEX_POSITION, 0,
    (unsigned char*)&position, sizeof(int));
  
  return dev->error.code;
}
Example #14
0
int epos_home_set_offset(epos_device_t* dev, int offset) {
  epos_device_write(dev, EPOS_HOME_INDEX_OFFSET, 0,
    (unsigned char*)&offset, sizeof(int));
  
  return dev->error.code;
}
Example #15
0
int epos_velocity_set_demand(epos_device_p dev, int velocity) {
  return epos_device_write(dev, EPOS_VELOCITY_INDEX_SETTING_VALUE, 0,
    (unsigned char*)&velocity, sizeof(int));
}
Example #16
0
int epos_position_profile_set_target(epos_device_t* dev, int position) {
  epos_device_write(dev, EPOS_POSITION_PROFILE_INDEX_TARGET, 0,
    (unsigned char*)&position, sizeof(int));
  
  return dev->error.code;
}
Example #17
0
int epos_home_set_current_threshold(epos_device_t* dev, short current) {
  epos_device_write(dev, EPOS_HOME_INDEX_CURRENT_THRESHOLD, 0,
    (unsigned char*)&current, sizeof(short));
  
  return dev->error.code;
}
Example #18
0
int epos_velocity_set_i_gain(epos_device_p dev, short i_gain) {
  return epos_device_write(dev, EPOS_VELOCITY_INDEX_CONTROL_PARAMETERS,
    EPOS_VELOCITY_SUBINDEX_I_GAIN, (unsigned char*)&i_gain, sizeof(short));
}
Example #19
0
int epos_error_clear_history(epos_device_p dev) {
  unsigned char length = 0;
  return epos_device_write(dev, EPOS_ERROR_INDEX_HISTORY,
    EPOS_ERROR_SUBINDEX_HISTORY_LENGTH, &length, 1);
}