#ifndef __LED_H
#define __LED_H
//----------------------------------------------------------------------------
///
/// \brief  Class for LED
///
///         See implementation for further information.
///
/// \date   20121107
/// \author Maximilian Seesslen <development.seesslen.net>
///
//----------------------------------------------------------------------------


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


///---General-------------------------

#include <biwak/gpio.hpp>

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

#include <biwak/output.hpp>


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


// How many systicks have to occure till a blinking led is switched.
#define HANDLER_BLINK_LED        0x0
#define APPLICATION_BLINK_LED    0x2

#define BLINK_CODE_ON      -3
#define BLINK_CODE_OFF     -4
#define BLINK_CODE_LOOP    -1
#define BLINK_CODE_END     -2
#if defined BIWAK_OUTPUT_SWITCH
   #error BIWAK_OUTPUT_SWITCH is not supported any more
#endif


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


// int16_t saves some bytes compared to int
typedef const int16_t SBlinkEntry;
typedef const SBlinkEntry *SBlinkMode;


class CLed
      :public COutput
{
   private:
      SBlinkMode m_blinkMode;
      lrtimer_t blinkerTimer;
      //uint8_t blinkArrayPos;
      int blinkArrayPos;

    public:
      void setBlinkMode( SBlinkMode blinkMode );
      SBlinkMode getBlinkMode( )
      {
         return( m_blinkMode );
      };
        
      CLed(EGpioPeripheral _eGpioPeripheral, EGpioPin _eGpioPin);
      CLed(const char* label);
      ~CLed();
      
      void eventLoop( );
};


//---fin-----------------------------------------------------------------------
#endif
