short epos_input_get_enabled(epos_input_p input) { short enabled; epos_device_read(input->dev, EPOS_INPUT_INDEX_FUNCS, EPOS_INPUT_SUBINDEX_MASK, (unsigned char*)&enabled, sizeof(short)); return enabled; }
short epos_input_get_polarity(epos_input_p input) { short polarity; epos_device_read(input->dev, EPOS_INPUT_INDEX_FUNCS, EPOS_INPUT_SUBINDEX_POLARITY, (unsigned char*)&polarity, sizeof(short)); return polarity; }
short epos_input_get_execute(epos_input_p input) { short execute; epos_device_read(input->dev, EPOS_INPUT_INDEX_FUNCS, EPOS_INPUT_SUBINDEX_EXECUTE, (unsigned char*)&execute, sizeof(short)); return execute; }
int epos_sensor_get_pulses(epos_sensor_t* sensor) { int pulses = 0; if (sensor->dev->hardware_generation == 1) { short pulses_short; if (epos_device_read(sensor->dev, EPOS_SENSOR_INDEX_CONFIGURATION, EPOS_SENSOR_SUBINDEX_PULSES, (unsigned char*)&pulses_short, sizeof(short)) > 0) pulses = pulses_short; } else epos_device_read(sensor->dev, EPOS_SENSOR_INDEX_CONFIGURATION, EPOS_SENSOR_SUBINDEX_PULSES, (unsigned char*)&pulses, sizeof(int)); return pulses; }
short epos_sensor_get_position(epos_sensor_t* sensor) { short pos = 0; epos_device_read(sensor->dev, EPOS_SENSOR_INDEX_POSITION, 0, (unsigned char*)&pos, sizeof(short)); return pos; }
unsigned char epos_error_get_history_length(epos_device_p dev) { unsigned char length; epos_device_read(dev, EPOS_ERROR_INDEX_HISTORY, EPOS_ERROR_SUBINDEX_HISTORY_LENGTH, &length, 1); return length; }
int epos_velocity_get_demand(epos_device_p dev) { int vel; epos_device_read(dev, EPOS_VELOCITY_INDEX_DEMAND_VALUE, 0, (unsigned char*)&vel, sizeof(int)); return vel; }
int epos_velocity_get_average(epos_device_p dev) { int vel; epos_device_read(dev, EPOS_VELOCITY_INDEX_AVERAGE_VALUE, 0, (unsigned char*)&vel, sizeof(int)); return vel; }
int epos_velocity_get_actual(epos_device_p dev) { int vel; epos_device_read(dev, EPOS_VELOCITY_INDEX_ACTUAL_VALUE, 0, (unsigned char*)&vel, sizeof(int)); return vel; }
epos_input_func_type_t epos_input_get_channel_func(epos_input_p input, int channel) { short type; epos_device_read(input->dev, EPOS_INPUT_INDEX_CONFIG, channel, (unsigned char*)&type, sizeof(short)); return type; }
int epos_input_get_func_state(epos_input_p input, epos_input_func_type_t type) { short mask = 0x0001 << type; short state = 0; epos_device_read(input->dev, EPOS_INPUT_INDEX_FUNCS, EPOS_INPUT_SUBINDEX_STATE, (unsigned char*)&state, sizeof(short)); return ((state & mask) != 0); }
epos_sensor_type_t epos_sensor_get_type(epos_sensor_t* sensor) { short type = 0; if (epos_device_read(sensor->dev, EPOS_SENSOR_INDEX_CONFIGURATION, EPOS_SENSOR_SUBINDEX_TYPE, (unsigned char*)&type, sizeof(short)) > 0) { int i; for (i = 0; i < sizeof(epos_sensor_types)/sizeof(short); ++i) if (epos_sensor_types[i] == type) return i; } else return -1; return type; }
epos_sensor_polarity_t epos_sensor_get_polarity(epos_sensor_t* sensor) { short polarity = 0; if (epos_device_read(sensor->dev, EPOS_SENSOR_INDEX_CONFIGURATION, EPOS_SENSOR_SUBINDEX_POLARITY, (unsigned char*)&polarity, sizeof(short)) > 0) { int i; for (i = 0; i < sizeof(epos_sensor_polarities)/sizeof(short); ++i) if (epos_sensor_polarities[i] == polarity) return i; } else return -1; return polarity; }
unsigned char epos_error_get_history(epos_device_p dev, epos_error_device_t history[]) { int i, num = 0; unsigned char length = epos_error_get_history_length(dev); for (i = 0; i < length; ++i) { int code; if (!epos_device_read(dev, EPOS_ERROR_INDEX_HISTORY, EPOS_ERROR_SUBINDEX_HISTORY_ENTRIES+i, (unsigned char*)&code, sizeof(int))) { history[num].code = code; history[num].reg = 0; history[num].message = epos_error_device(history[num].code); ++num; } } return num; }
epos_control_type_t epos_control_get_type(epos_control_p control) { char type; epos_device_read(control->dev, EPOS_CONTROL_INDEX_MODE_DISPLAY, 0, &type, 1); return type; }