#ifndef _BIWAK_RFID_H_
#define _BIWAK_RFID_H_
//----------------------------------------------------------------------------
///
/// \brief  an RFID chip reader
///
///         See implementation for further information.
///
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


//---Includes-----------------------------------------------------------------


//---Own------------------------------

#include <biwak/input.h>
#include <biwak/input_decoder.h>


//---Declaration--------------------------------------------------------------


class CRfidDecoder
         : public CInputDecoderRecorder
{
   friend class CRfid;

protected:
   char version=0;
   uint32_t id=0;
public:
   CRfidDecoder();

   virtual void decodeFrame();
   void dumpSlopes();
};


/// \brief  an RFID chip reader
///
///         CInput already is an interrupt (Exti), so we just have to overload
///         the interrupt handler.
class CRfid
         :public CInput
{
   private:
      CRfidDecoder   m_decoder;

   public:
      CRfid(EGpioPeripheral _eGpioPeripheral, EGpioPin _eGpioPin);
      ~CRfid();

      char getVersion()
      {
         return(m_decoder.version);
      }
      uint32_t getId()
      {
         return(m_decoder.id);
      }
};


//---fin----------------------------------------------------------------------
#endif // ? ! _BIWAK_RFID_H_
