#include "Adc.h"

Adc::Adc() : _lastChannel(0), _adcSetting(0,0), _state(IDLING), _sampledValue(0), _numOfSamples(0), _elapsedTime(0)
{
  //Serial.println("Adc constructor called");
}

Adc::~Adc()
{
  
}

void Adc::setAdcSetting(AdcSetting adcSetting)
{
  _adcSetting = adcSetting;
}

AdcSetting Adc::getAdcSetting()
{
  return _adcSetting;
}

boolean Adc::isSampleReady()
{
  return _state == RESULT_READY;
}

double Adc::getQuantum()
{
  return _adcSetting.getQuantum();
}

double Adc::getSampleValue()
{
  double ret(0);
  if(_state == RESULT_READY)
  {
    ret = _sampledValue;
    _state = IDLING;
  }
  
  return ret;
}
