/* Take two samples from the ADC and determine if the input is floating. */
int32_t cn0414_open_wire_detect(struct cn0414_dev *dev, uint32_t voltage_chan1, uint32_t voltage_chan2, uint8_t *floating)
/* Take two samples from the ADC and determine if the input is floating. */
int32_t cn0414_open_wire_detect(struct cn0414_dev *dev, uint32_t voltage_chan1, uint32_t voltage_chan2, uint8_t *floating)
{
	int32_t ret;
	float fdata1, fdata2;
	ret = cn0414_compute_adc_value(dev, voltage_chan1, ADC_VOLTAGE_CHANNEL,
				       &fdata1);
	if(ret < 0)
		return ret;
	ret = cn0414_compute_adc_value(dev, voltage_chan2, ADC_VOLTAGE_CHANNEL,
				       &fdata2);
	if(ret < 0)
		return ret;
	if(((fdata1 - fdata2) < -0.3) || ((fdata1 - fdata2) > 0.3))
		*floating = 1;
	else
		*floating = 0;
	return ret;
}