//----------------------------------------------------------------------------
///
///
///
//----------------------------------------------------------------------------


#include <fosh/command.h>
#include <stdio.h>
#include <biwak/temperature.h>
#include <biwak/adc.hpp>

// #ifdef STM32
   //#include <arena/platform.h>
   #include <biwak/rtc.hpp>
// #endif


class CCommandTemp: public CCommand
{
private:
      CPlatform &pf;

   public:
      CCommandTemp(const char *_name, CPlatform &platform)
         :CCommand( _name, "   temp: get values from temperature sensor\n" )
         ,pf(platform)
      {}
      virtual int exec(int argc, const char *argv[]) const;
      virtual void printHelp() const;
};


int CCommandTemp::exec(int argc, const char *argv[] ) const /* virtual */
{
   int tInt, tExt;

   #if defined ARENA_USE_TSIC
      tExt=pf.temperature[0]->getTemperature();
   #else
      tExt=0;
   #endif

   #if defined ARENA_USE_ADC
      //tInt=pf.m_adc1.updateTemperature();
      tInt=0;
   #else
      tInt=0;
   #endif

   printf("Temperature: %d(int), %d(ext)\n", tInt, tExt);

   return(0);
}


const CCommand *createInstance_temp(CPlatform *platform)
{
   return( new CCommandTemp("temp", *platform) );
}

#if 0
STTERM_COMMAND(temp);
#endif

//---fin----------------------------------------------------------------------
