uint16_t ADConverter::read(ADCDevice_e device) {
	// todo check SetInputChannel method
//	ADC_SetInputChannel(ADC_Input_ADC1);
//	ADMUX &= 0xF0;                    //Clear the older channel that was read
	reg::admux::reg_and(0xF0);
//	ADMUX |= device;                //Defines the new ADC channel to be read
	reg::admux::reg_or(device);
	ADC_StartConversion();
	while (ADC_ConversionInProgress()) {
	}
	return ADC_GetDataRegister();
}
int analogRead(uint8_t pin)
{
  #if defined( CORE_ANALOG_FIRST )
    if ( pin >= CORE_ANALOG_FIRST ) pin -= CORE_ANALOG_FIRST; // allow for channel or pin numbers
  #endif

  // fix? Validate pin?

  ADC_SetVoltageReference( analog_reference );
  ADC_SetInputChannel( pin );

  ADC_StartConversion();

  while( ADC_ConversionInProgress() );

  return( ADC_GetDataRegister() );
}