#ifndef _WATCHDOG_H_
#define _WATCHDOG_H_
//----------------------------------------------------------------------------
///
/// \brief  Watchdog
///
///         See implementation files for further information.
//
/// \date   20150915
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


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


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



//---Defines------------------------------------------------------------------



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


enum EWatchdogState
{
   eWatchdogStateStarted,
   eWatchdogStateStopped,
};


//struct IWDG_HandleTypeDef;
//typedef struct IWDG_HandleTypeDef_s IWDG_HandleTypeDef;
//typedef struct IWDG_HandleTypeDef IWDG_HandleTypeDef;
//struct IWDG_HandleTypeDef;
#if defined (MCU_PLATFORM_STM32)
   #define WATCHDOG_HANDLE_TYPE    IWDG_HandleTypeDef
   #include <HALWrapper/stm32_wdg.h>
#else
   #define WATCHDOG_HANDLE_TYPE    void
#endif


class CWatchdog
{

   private:
      WATCHDOG_HANDLE_TYPE *m_pHandler;
      //void *pHandler; // IWDG_HandleTypeDef
      EWatchdogState eWatchdogState;

   public:

      CWatchdog( );
      void init();
      ~CWatchdog()
      {
      }

      WATCHDOG_HANDLE_TYPE *getHandler()
      {
         return(m_pHandler);
      }
      void start();
      void stop();
      void trigger();
};


extern uint8_t watchdogKeeper;

//void watchdogKeeper(void);


//---fin----------------------------------------------------------------------
#endif // ? ! _WATCHDOG_H_
