/* Reads data from the specified adc channel fifo.  */
float analogin_read(analogin_t *obj)
/* Reads data from the specified adc channel fifo.  */
float analogin_read(analogin_t *obj)
{
	float value;
	uint32_t AnalogDatFull = 0xFFF;
	uint8_t  ChIdx = obj->adc_idx;
	uint32_t data;
	ADC->ADC_CHSW_LIST[0] = ChIdx;
	ADC_ClearFIFO();
	ADC_SWTrigCmd(ENABLE);
	while(ADC_Readable()== 0);
	ADC_SWTrigCmd(DISABLE);
	data = ADC_Read();
	value = (float)(data) / (float)(AnalogDatFull);
	return (float)value;
}