#include "ThermostatKeys.h"

void vfnThermostatKeys_Init(void)
{
  vfnKeyboard_Init(((1<<TIME_PIN) | (1<<UP_PIN) | (1<<DOWN_PIN) | (1<<PROGRAM_PIN)), KB_INTERRUPT_ENABLED);
  /*
  PTCDD_PTCDD2 = 0;
  PTCPE_PTCPE2 = 1;
  */
  PTCPE_PTCPE7 = 1;
  IRQ_CONFIG();
  IRQSC_IRQACK = 1;
  
}


UINT8 u8ThermostatGetKey(void)
{
  if (TIME_DATE_KEY)
  {
    TIME_DATE_KEY_CLEAR;
    return (TIME_DATE_KEY_PRESSED);
  }
  
  if (UP_KEY)
  {
    UP_KEY_CLEAR;
    return (UP_KEY_PRESSED);
  }
  
  if (DOWN_KEY)
  {
    DOWN_KEY_CLEAR;
    return (DOWN_KEY_PRESSED);
  }
  
  if (PROGRAM_KEY)
  {
    PROGRAM_KEY_CLEAR;
    return (PROGRAM_KEY_PRESSED);
  }
  
  if (RUN_HOLD_KEY)
  {
    RUN_HOLD_KEY_CLEAR;
    return (RUN_HOLD_KEY_PRESSED);
  }
}