First draft HMC5883 magnetometer sensor using physical quantities, outputting via serial port using std::cout on mbed os 5

Sensor.h

Committer:
skyscraper
Date:
2020-03-26
Revision:
11:de7c9ae7ef65
Parent:
3:2834be4e10ef

File content as of revision 11:de7c9ae7ef65:

#ifndef SKYSCRAPER_MBED_SENSOR_H_INCLUDED
#define SKYSCRAPER_MBED_SENSOR_H_INCLUDED

   namespace detail{
      template <typename Quantity>
      struct SensorBackEnd;
   }
   
   template <typename Quantity>
   struct Sensor{
      
      static bool open(Sensor& sensor, const char* name);
      bool connected()const;
      bool running() const;
      bool idle() const
      void close();
      bool read(Quantity & q)const;
      bool setUpdateCallback(void(*pFun)(Sensor & ));
      
      private :
        SensorBackEnd<Quantity> * m_device;
   };

#endif