Пример #1
0
int master_get_chibi_master_address(Master *master, uint8_t *ret_address) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.type = TYPE_GET_CHIBI_MASTER_ADDRESS;
	master->answer.length = sizeof(GetChibiMasterAddressReturn_);
	GetChibiMasterAddress_ gcma;
	gcma.stack_id = master->stack_id;
	gcma.type = TYPE_GET_CHIBI_MASTER_ADDRESS;
	gcma.length = sizeof(GetChibiMasterAddress_);

	ipcon_device_write(master, (char *)&gcma, sizeof(GetChibiMasterAddress_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	GetChibiMasterAddressReturn_ *gcmar = (GetChibiMasterAddressReturn_ *)master->answer.buffer;
	*ret_address = gcmar->address;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #2
0
int lcd_20x4_is_button_pressed(LCD20x4 *lcd_20x4, uint8_t button, bool *ret_pressed) {
	if(lcd_20x4->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(lcd_20x4);

	lcd_20x4->answer.function_id = FUNCTION_IS_BUTTON_PRESSED;
	lcd_20x4->answer.length = sizeof(IsButtonPressedReturn_);
	IsButtonPressed_ ibp;
	ibp.stack_id = lcd_20x4->stack_id;
	ibp.function_id = FUNCTION_IS_BUTTON_PRESSED;
	ibp.length = sizeof(IsButtonPressed_);
	ibp.button = button;

	ipcon_device_write(lcd_20x4, (char *)&ibp, sizeof(IsButtonPressed_));

	if(ipcon_answer_sem_wait_timeout(lcd_20x4) != 0) {
		ipcon_sem_post_write(lcd_20x4);
		return E_TIMEOUT;
	}

	IsButtonPressedReturn_ *ibpr = (IsButtonPressedReturn_ *)lcd_20x4->answer.buffer;
	*ret_pressed = ibpr->pressed;

	ipcon_sem_post_write(lcd_20x4);

	return E_OK;
}
Пример #3
0
int lcd_20x4_get_config(LCD20x4 *lcd_20x4, bool *ret_cursor, bool *ret_blinking) {
	if(lcd_20x4->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(lcd_20x4);

	lcd_20x4->answer.function_id = FUNCTION_GET_CONFIG;
	lcd_20x4->answer.length = sizeof(GetConfigReturn_);
	GetConfig_ gc;
	gc.stack_id = lcd_20x4->stack_id;
	gc.function_id = FUNCTION_GET_CONFIG;
	gc.length = sizeof(GetConfig_);

	ipcon_device_write(lcd_20x4, (char *)&gc, sizeof(GetConfig_));

	if(ipcon_answer_sem_wait_timeout(lcd_20x4) != 0) {
		ipcon_sem_post_write(lcd_20x4);
		return E_TIMEOUT;
	}

	GetConfigReturn_ *gcr = (GetConfigReturn_ *)lcd_20x4->answer.buffer;
	*ret_cursor = gcr->cursor;
	*ret_blinking = gcr->blinking;

	ipcon_sem_post_write(lcd_20x4);

	return E_OK;
}
Пример #4
0
int lcd_20x4_is_backlight_on(LCD20x4 *lcd_20x4, bool *ret_backlight) {
	if(lcd_20x4->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(lcd_20x4);

	lcd_20x4->answer.function_id = FUNCTION_IS_BACKLIGHT_ON;
	lcd_20x4->answer.length = sizeof(IsBacklightOnReturn_);
	IsBacklightOn_ ibo;
	ibo.stack_id = lcd_20x4->stack_id;
	ibo.function_id = FUNCTION_IS_BACKLIGHT_ON;
	ibo.length = sizeof(IsBacklightOn_);

	ipcon_device_write(lcd_20x4, (char *)&ibo, sizeof(IsBacklightOn_));

	if(ipcon_answer_sem_wait_timeout(lcd_20x4) != 0) {
		ipcon_sem_post_write(lcd_20x4);
		return E_TIMEOUT;
	}

	IsBacklightOnReturn_ *ibor = (IsBacklightOnReturn_ *)lcd_20x4->answer.buffer;
	*ret_backlight = ibor->backlight;

	ipcon_sem_post_write(lcd_20x4);

	return E_OK;
}
Пример #5
0
int current12_get_current(Current12 *current12, int16_t *ret_current) {
	if(current12->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(current12);

	current12->answer.function_id = FUNCTION_GET_CURRENT;
	current12->answer.length = sizeof(GetCurrentReturn_);
	GetCurrent_ gc;
	gc.stack_id = current12->stack_id;
	gc.function_id = FUNCTION_GET_CURRENT;
	gc.length = sizeof(GetCurrent_);

	ipcon_device_write(current12, (char *)&gc, sizeof(GetCurrent_));

	if(ipcon_answer_sem_wait_timeout(current12) != 0) {
		ipcon_sem_post_write(current12);
		return E_TIMEOUT;
	}

	GetCurrentReturn_ *gcr = (GetCurrentReturn_ *)current12->answer.buffer;
	*ret_current = gcr->current;

	ipcon_sem_post_write(current12);

	return E_OK;
}
int temperature_ir_get_object_temperature_callback_period(TemperatureIR *temperature_ir, uint32_t *ret_period) {
	if(temperature_ir->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(temperature_ir);

	temperature_ir->answer.type = TYPE_GET_OBJECT_TEMPERATURE_CALLBACK_PERIOD;
	temperature_ir->answer.length = sizeof(GetObjectTemperatureCallbackPeriodReturn_);
	GetObjectTemperatureCallbackPeriod_ gotcp;
	gotcp.stack_id = temperature_ir->stack_id;
	gotcp.type = TYPE_GET_OBJECT_TEMPERATURE_CALLBACK_PERIOD;
	gotcp.length = sizeof(GetObjectTemperatureCallbackPeriod_);

	ipcon_device_write(temperature_ir, (char *)&gotcp, sizeof(GetObjectTemperatureCallbackPeriod_));

	if(ipcon_answer_sem_wait_timeout(temperature_ir) != 0) {
		ipcon_sem_post_write(temperature_ir);
		return E_TIMEOUT;
	}

	GetObjectTemperatureCallbackPeriodReturn_ *gotcpr = (GetObjectTemperatureCallbackPeriodReturn_ *)temperature_ir->answer.buffer;
	*ret_period = gotcpr->period;

	ipcon_sem_post_write(temperature_ir);

	return E_OK;
}
Пример #7
0
int temperature_get_debounce_period(Temperature *temperature, uint32_t *ret_debounce) {
	if(temperature->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(temperature);

	temperature->answer.function_id = FUNCTION_GET_DEBOUNCE_PERIOD;
	temperature->answer.length = sizeof(GetDebouncePeriodReturn_);
	GetDebouncePeriod_ gdp;
	gdp.stack_id = temperature->stack_id;
	gdp.function_id = FUNCTION_GET_DEBOUNCE_PERIOD;
	gdp.length = sizeof(GetDebouncePeriod_);

	ipcon_device_write(temperature, (char *)&gdp, sizeof(GetDebouncePeriod_));

	if(ipcon_answer_sem_wait_timeout(temperature) != 0) {
		ipcon_sem_post_write(temperature);
		return E_TIMEOUT;
	}

	GetDebouncePeriodReturn_ *gdpr = (GetDebouncePeriodReturn_ *)temperature->answer.buffer;
	*ret_debounce = gdpr->debounce;

	ipcon_sem_post_write(temperature);

	return E_OK;
}
Пример #8
0
int current12_get_debounce_period(Current12 *current12, uint32_t *ret_debounce) {
	if(current12->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(current12);

	current12->answer.function_id = FUNCTION_GET_DEBOUNCE_PERIOD;
	current12->answer.length = sizeof(GetDebouncePeriodReturn_);
	GetDebouncePeriod_ gdp;
	gdp.stack_id = current12->stack_id;
	gdp.function_id = FUNCTION_GET_DEBOUNCE_PERIOD;
	gdp.length = sizeof(GetDebouncePeriod_);

	ipcon_device_write(current12, (char *)&gdp, sizeof(GetDebouncePeriod_));

	if(ipcon_answer_sem_wait_timeout(current12) != 0) {
		ipcon_sem_post_write(current12);
		return E_TIMEOUT;
	}

	GetDebouncePeriodReturn_ *gdpr = (GetDebouncePeriodReturn_ *)current12->answer.buffer;
	*ret_debounce = gdpr->debounce;

	ipcon_sem_post_write(current12);

	return E_OK;
}
int temperature_ir_get_object_temperature(TemperatureIR *temperature_ir, int16_t *ret_temperature) {
	if(temperature_ir->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(temperature_ir);

	temperature_ir->answer.type = TYPE_GET_OBJECT_TEMPERATURE;
	temperature_ir->answer.length = sizeof(GetObjectTemperatureReturn_);
	GetObjectTemperature_ got;
	got.stack_id = temperature_ir->stack_id;
	got.type = TYPE_GET_OBJECT_TEMPERATURE;
	got.length = sizeof(GetObjectTemperature_);

	ipcon_device_write(temperature_ir, (char *)&got, sizeof(GetObjectTemperature_));

	if(ipcon_answer_sem_wait_timeout(temperature_ir) != 0) {
		ipcon_sem_post_write(temperature_ir);
		return E_TIMEOUT;
	}

	GetObjectTemperatureReturn_ *gotr = (GetObjectTemperatureReturn_ *)temperature_ir->answer.buffer;
	*ret_temperature = gotr->temperature;

	ipcon_sem_post_write(temperature_ir);

	return E_OK;
}
Пример #10
0
int current12_get_analog_value_callback_threshold(Current12 *current12, char *ret_option, uint16_t *ret_min, uint16_t *ret_max) {
	if(current12->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(current12);

	current12->answer.function_id = FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD;
	current12->answer.length = sizeof(GetAnalogValueCallbackThresholdReturn_);
	GetAnalogValueCallbackThreshold_ gavct;
	gavct.stack_id = current12->stack_id;
	gavct.function_id = FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD;
	gavct.length = sizeof(GetAnalogValueCallbackThreshold_);

	ipcon_device_write(current12, (char *)&gavct, sizeof(GetAnalogValueCallbackThreshold_));

	if(ipcon_answer_sem_wait_timeout(current12) != 0) {
		ipcon_sem_post_write(current12);
		return E_TIMEOUT;
	}

	GetAnalogValueCallbackThresholdReturn_ *gavctr = (GetAnalogValueCallbackThresholdReturn_ *)current12->answer.buffer;
	*ret_option = gavctr->option;
	*ret_min = gavctr->min;
	*ret_max = gavctr->max;

	ipcon_sem_post_write(current12);

	return E_OK;
}
Пример #11
0
int current12_get_analog_value_callback_period(Current12 *current12, uint32_t *ret_period) {
	if(current12->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(current12);

	current12->answer.function_id = FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD;
	current12->answer.length = sizeof(GetAnalogValueCallbackPeriodReturn_);
	GetAnalogValueCallbackPeriod_ gavcp;
	gavcp.stack_id = current12->stack_id;
	gavcp.function_id = FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD;
	gavcp.length = sizeof(GetAnalogValueCallbackPeriod_);

	ipcon_device_write(current12, (char *)&gavcp, sizeof(GetAnalogValueCallbackPeriod_));

	if(ipcon_answer_sem_wait_timeout(current12) != 0) {
		ipcon_sem_post_write(current12);
		return E_TIMEOUT;
	}

	GetAnalogValueCallbackPeriodReturn_ *gavcpr = (GetAnalogValueCallbackPeriodReturn_ *)current12->answer.buffer;
	*ret_period = gavcpr->period;

	ipcon_sem_post_write(current12);

	return E_OK;
}
Пример #12
0
int current12_get_analog_value(Current12 *current12, uint16_t *ret_value) {
	if(current12->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(current12);

	current12->answer.function_id = FUNCTION_GET_ANALOG_VALUE;
	current12->answer.length = sizeof(GetAnalogValueReturn_);
	GetAnalogValue_ gav;
	gav.stack_id = current12->stack_id;
	gav.function_id = FUNCTION_GET_ANALOG_VALUE;
	gav.length = sizeof(GetAnalogValue_);

	ipcon_device_write(current12, (char *)&gav, sizeof(GetAnalogValue_));

	if(ipcon_answer_sem_wait_timeout(current12) != 0) {
		ipcon_sem_post_write(current12);
		return E_TIMEOUT;
	}

	GetAnalogValueReturn_ *gavr = (GetAnalogValueReturn_ *)current12->answer.buffer;
	*ret_value = gavr->value;

	ipcon_sem_post_write(current12);

	return E_OK;
}
int temperature_ir_get_emissivity(TemperatureIR *temperature_ir, uint16_t *ret_emissivity) {
	if(temperature_ir->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(temperature_ir);

	temperature_ir->answer.type = TYPE_GET_EMISSIVITY;
	temperature_ir->answer.length = sizeof(GetEmissivityReturn_);
	GetEmissivity_ ge;
	ge.stack_id = temperature_ir->stack_id;
	ge.type = TYPE_GET_EMISSIVITY;
	ge.length = sizeof(GetEmissivity_);

	ipcon_device_write(temperature_ir, (char *)&ge, sizeof(GetEmissivity_));

	if(ipcon_answer_sem_wait_timeout(temperature_ir) != 0) {
		ipcon_sem_post_write(temperature_ir);
		return E_TIMEOUT;
	}

	GetEmissivityReturn_ *ger = (GetEmissivityReturn_ *)temperature_ir->answer.buffer;
	*ret_emissivity = ger->emissivity;

	ipcon_sem_post_write(temperature_ir);

	return E_OK;
}
Пример #14
0
int master_get_stack_voltage(Master *master, uint16_t *ret_voltage) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.function_id = FUNCTION_GET_STACK_VOLTAGE;
	master->answer.length = sizeof(GetStackVoltageReturn_);
	GetStackVoltage_ gsv;
	gsv.stack_id = master->stack_id;
	gsv.function_id = FUNCTION_GET_STACK_VOLTAGE;
	gsv.length = sizeof(GetStackVoltage_);

	ipcon_device_write(master, (char *)&gsv, sizeof(GetStackVoltage_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	GetStackVoltageReturn_ *gsvr = (GetStackVoltageReturn_ *)master->answer.buffer;
	*ret_voltage = gsvr->voltage;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #15
0
int temperature_get_temperature_callback_period(Temperature *temperature, uint32_t *ret_period) {
	if(temperature->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(temperature);

	temperature->answer.function_id = FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD;
	temperature->answer.length = sizeof(GetTemperatureCallbackPeriodReturn_);
	GetTemperatureCallbackPeriod_ gtcp;
	gtcp.stack_id = temperature->stack_id;
	gtcp.function_id = FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD;
	gtcp.length = sizeof(GetTemperatureCallbackPeriod_);

	ipcon_device_write(temperature, (char *)&gtcp, sizeof(GetTemperatureCallbackPeriod_));

	if(ipcon_answer_sem_wait_timeout(temperature) != 0) {
		ipcon_sem_post_write(temperature);
		return E_TIMEOUT;
	}

	GetTemperatureCallbackPeriodReturn_ *gtcpr = (GetTemperatureCallbackPeriodReturn_ *)temperature->answer.buffer;
	*ret_period = gtcpr->period;

	ipcon_sem_post_write(temperature);

	return E_OK;
}
Пример #16
0
int temperature_get_temperature(Temperature *temperature, int16_t *ret_temperature) {
	if(temperature->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(temperature);

	temperature->answer.function_id = FUNCTION_GET_TEMPERATURE;
	temperature->answer.length = sizeof(GetTemperatureReturn_);
	GetTemperature_ gt;
	gt.stack_id = temperature->stack_id;
	gt.function_id = FUNCTION_GET_TEMPERATURE;
	gt.length = sizeof(GetTemperature_);

	ipcon_device_write(temperature, (char *)&gt, sizeof(GetTemperature_));

	if(ipcon_answer_sem_wait_timeout(temperature) != 0) {
		ipcon_sem_post_write(temperature);
		return E_TIMEOUT;
	}

	GetTemperatureReturn_ *gtr = (GetTemperatureReturn_ *)temperature->answer.buffer;
	*ret_temperature = gtr->temperature;

	ipcon_sem_post_write(temperature);

	return E_OK;
}
Пример #17
0
int master_get_stack_current(Master *master, uint16_t *ret_current) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.function_id = FUNCTION_GET_STACK_CURRENT;
	master->answer.length = sizeof(GetStackCurrentReturn_);
	GetStackCurrent_ gsc;
	gsc.stack_id = master->stack_id;
	gsc.function_id = FUNCTION_GET_STACK_CURRENT;
	gsc.length = sizeof(GetStackCurrent_);

	ipcon_device_write(master, (char *)&gsc, sizeof(GetStackCurrent_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	GetStackCurrentReturn_ *gscr = (GetStackCurrentReturn_ *)master->answer.buffer;
	*ret_current = gscr->current;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #18
0
int master_get_chibi_frequency(Master *master, uint8_t *ret_frequency) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.function_id = FUNCTION_GET_CHIBI_FREQUENCY;
	master->answer.length = sizeof(GetChibiFrequencyReturn_);
	GetChibiFrequency_ gcf;
	gcf.stack_id = master->stack_id;
	gcf.function_id = FUNCTION_GET_CHIBI_FREQUENCY;
	gcf.length = sizeof(GetChibiFrequency_);

	ipcon_device_write(master, (char *)&gcf, sizeof(GetChibiFrequency_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	GetChibiFrequencyReturn_ *gcfr = (GetChibiFrequencyReturn_ *)master->answer.buffer;
	*ret_frequency = gcfr->frequency;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #19
0
int master_get_chibi_channel(Master *master, uint8_t *ret_channel) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.function_id = FUNCTION_GET_CHIBI_CHANNEL;
	master->answer.length = sizeof(GetChibiChannelReturn_);
	GetChibiChannel_ gcc;
	gcc.stack_id = master->stack_id;
	gcc.function_id = FUNCTION_GET_CHIBI_CHANNEL;
	gcc.length = sizeof(GetChibiChannel_);

	ipcon_device_write(master, (char *)&gcc, sizeof(GetChibiChannel_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	GetChibiChannelReturn_ *gccr = (GetChibiChannelReturn_ *)master->answer.buffer;
	*ret_channel = gccr->channel;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #20
0
int master_get_chibi_signal_strength(Master *master, uint8_t *ret_signal_strength) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.function_id = FUNCTION_GET_CHIBI_SIGNAL_STRENGTH;
	master->answer.length = sizeof(GetChibiSignalStrengthReturn_);
	GetChibiSignalStrength_ gcss;
	gcss.stack_id = master->stack_id;
	gcss.function_id = FUNCTION_GET_CHIBI_SIGNAL_STRENGTH;
	gcss.length = sizeof(GetChibiSignalStrength_);

	ipcon_device_write(master, (char *)&gcss, sizeof(GetChibiSignalStrength_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	GetChibiSignalStrengthReturn_ *gcssr = (GetChibiSignalStrengthReturn_ *)master->answer.buffer;
	*ret_signal_strength = gcssr->signal_strength;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #21
0
int master_get_chibi_error_log(Master *master, uint16_t *ret_underrun, uint16_t *ret_crc_error, uint16_t *ret_no_ack, uint16_t *ret_overflow) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.function_id = FUNCTION_GET_CHIBI_ERROR_LOG;
	master->answer.length = sizeof(GetChibiErrorLogReturn_);
	GetChibiErrorLog_ gcel;
	gcel.stack_id = master->stack_id;
	gcel.function_id = FUNCTION_GET_CHIBI_ERROR_LOG;
	gcel.length = sizeof(GetChibiErrorLog_);

	ipcon_device_write(master, (char *)&gcel, sizeof(GetChibiErrorLog_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	GetChibiErrorLogReturn_ *gcelr = (GetChibiErrorLogReturn_ *)master->answer.buffer;
	*ret_underrun = gcelr->underrun;
	*ret_crc_error = gcelr->crc_error;
	*ret_no_ack = gcelr->no_ack;
	*ret_overflow = gcelr->overflow;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #22
0
int master_is_chibi_present(Master *master, bool *ret_present) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.function_id = FUNCTION_IS_CHIBI_PRESENT;
	master->answer.length = sizeof(IsChibiPresentReturn_);
	IsChibiPresent_ icp;
	icp.stack_id = master->stack_id;
	icp.function_id = FUNCTION_IS_CHIBI_PRESENT;
	icp.length = sizeof(IsChibiPresent_);

	ipcon_device_write(master, (char *)&icp, sizeof(IsChibiPresent_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	IsChibiPresentReturn_ *icpr = (IsChibiPresentReturn_ *)master->answer.buffer;
	*ret_present = icpr->present;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #23
0
int master_get_chibi_slave_address(Master *master, uint8_t num, uint8_t *ret_address) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.function_id = FUNCTION_GET_CHIBI_SLAVE_ADDRESS;
	master->answer.length = sizeof(GetChibiSlaveAddressReturn_);
	GetChibiSlaveAddress_ gcsa;
	gcsa.stack_id = master->stack_id;
	gcsa.function_id = FUNCTION_GET_CHIBI_SLAVE_ADDRESS;
	gcsa.length = sizeof(GetChibiSlaveAddress_);
	gcsa.num = num;

	ipcon_device_write(master, (char *)&gcsa, sizeof(GetChibiSlaveAddress_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	GetChibiSlaveAddressReturn_ *gcsar = (GetChibiSlaveAddressReturn_ *)master->answer.buffer;
	*ret_address = gcsar->address;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #24
0
int master_get_extension_type(Master *master, uint8_t extension, uint32_t *ret_exttype) {
	if(master->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(master);

	master->answer.function_id = FUNCTION_GET_EXTENSION_TYPE;
	master->answer.length = sizeof(GetExtensionTypeReturn_);
	GetExtensionType_ get;
	get.stack_id = master->stack_id;
	get.function_id = FUNCTION_GET_EXTENSION_TYPE;
	get.length = sizeof(GetExtensionType_);
	get.extension = extension;

	ipcon_device_write(master, (char *)&get, sizeof(GetExtensionType_));

	if(ipcon_answer_sem_wait_timeout(master) != 0) {
		ipcon_sem_post_write(master);
		return E_TIMEOUT;
	}

	GetExtensionTypeReturn_ *getr = (GetExtensionTypeReturn_ *)master->answer.buffer;
	*ret_exttype = getr->exttype;

	ipcon_sem_post_write(master);

	return E_OK;
}
Пример #25
0
int current12_is_over_current(Current12 *current12, bool *ret_over) {
	if(current12->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(current12);

	current12->answer.function_id = FUNCTION_IS_OVER_CURRENT;
	current12->answer.length = sizeof(IsOverCurrentReturn_);
	IsOverCurrent_ ioc;
	ioc.stack_id = current12->stack_id;
	ioc.function_id = FUNCTION_IS_OVER_CURRENT;
	ioc.length = sizeof(IsOverCurrent_);

	ipcon_device_write(current12, (char *)&ioc, sizeof(IsOverCurrent_));

	if(ipcon_answer_sem_wait_timeout(current12) != 0) {
		ipcon_sem_post_write(current12);
		return E_TIMEOUT;
	}

	IsOverCurrentReturn_ *iocr = (IsOverCurrentReturn_ *)current12->answer.buffer;
	*ret_over = iocr->over;

	ipcon_sem_post_write(current12);

	return E_OK;
}
Пример #26
0
int temperature_get_temperature_callback_threshold(Temperature *temperature, char *ret_option, int16_t *ret_min, int16_t *ret_max) {
	if(temperature->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(temperature);

	temperature->answer.function_id = FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD;
	temperature->answer.length = sizeof(GetTemperatureCallbackThresholdReturn_);
	GetTemperatureCallbackThreshold_ gtct;
	gtct.stack_id = temperature->stack_id;
	gtct.function_id = FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD;
	gtct.length = sizeof(GetTemperatureCallbackThreshold_);

	ipcon_device_write(temperature, (char *)&gtct, sizeof(GetTemperatureCallbackThreshold_));

	if(ipcon_answer_sem_wait_timeout(temperature) != 0) {
		ipcon_sem_post_write(temperature);
		return E_TIMEOUT;
	}

	GetTemperatureCallbackThresholdReturn_ *gtctr = (GetTemperatureCallbackThresholdReturn_ *)temperature->answer.buffer;
	*ret_option = gtctr->option;
	*ret_min = gtctr->min;
	*ret_max = gtctr->max;

	ipcon_sem_post_write(temperature);

	return E_OK;
}
int temperature_ir_get_object_temperature_callback_threshold(TemperatureIR *temperature_ir, char *ret_option, int16_t *ret_min, int16_t *ret_max) {
	if(temperature_ir->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(temperature_ir);

	temperature_ir->answer.type = TYPE_GET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD;
	temperature_ir->answer.length = sizeof(GetObjectTemperatureCallbackThresholdReturn_);
	GetObjectTemperatureCallbackThreshold_ gotct;
	gotct.stack_id = temperature_ir->stack_id;
	gotct.type = TYPE_GET_OBJECT_TEMPERATURE_CALLBACK_THRESHOLD;
	gotct.length = sizeof(GetObjectTemperatureCallbackThreshold_);

	ipcon_device_write(temperature_ir, (char *)&gotct, sizeof(GetObjectTemperatureCallbackThreshold_));

	if(ipcon_answer_sem_wait_timeout(temperature_ir) != 0) {
		ipcon_sem_post_write(temperature_ir);
		return E_TIMEOUT;
	}

	GetObjectTemperatureCallbackThresholdReturn_ *gotctr = (GetObjectTemperatureCallbackThresholdReturn_ *)temperature_ir->answer.buffer;
	*ret_option = gotctr->option;
	*ret_min = gotctr->min;
	*ret_max = gotctr->max;

	ipcon_sem_post_write(temperature_ir);

	return E_OK;
}
Пример #28
0
int lcd_20x4_backlight_off(LCD20x4 *lcd_20x4) {
	if(lcd_20x4->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(lcd_20x4);

	BacklightOff_ bo;
	bo.stack_id = lcd_20x4->stack_id;
	bo.function_id = FUNCTION_BACKLIGHT_OFF;
	bo.length = sizeof(BacklightOff_);

	ipcon_device_write(lcd_20x4, (char *)&bo, sizeof(BacklightOff_));

	ipcon_sem_post_write(lcd_20x4);

	return E_OK;
}
Пример #29
0
int lcd_20x4_clear_display(LCD20x4 *lcd_20x4) {
	if(lcd_20x4->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(lcd_20x4);

	ClearDisplay_ cd;
	cd.stack_id = lcd_20x4->stack_id;
	cd.function_id = FUNCTION_CLEAR_DISPLAY;
	cd.length = sizeof(ClearDisplay_);

	ipcon_device_write(lcd_20x4, (char *)&cd, sizeof(ClearDisplay_));

	ipcon_sem_post_write(lcd_20x4);

	return E_OK;
}
Пример #30
0
int current12_calibrate(Current12 *current12) {
	if(current12->ipcon == NULL) {
		return E_NOT_ADDED;
	}

	ipcon_sem_wait_write(current12);

	Calibrate_ c;
	c.stack_id = current12->stack_id;
	c.function_id = FUNCTION_CALIBRATE;
	c.length = sizeof(Calibrate_);

	ipcon_device_write(current12, (char *)&c, sizeof(Calibrate_));

	ipcon_sem_post_write(current12);

	return E_OK;
}