/*
 * klavesnica.h
 *
 *  Created on: 27.4.2010
 *      Author: hudo
 */

#ifndef KLAVESNICA_H_
#define KLAVESNICA_H_
#include "MCF52233_PE.h"
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "FreeRTOS.h"
#include "queue.h"
#include "semphr.h"
#include "task.h"

xSemaphoreHandle klavesnicaGetKeyMutex;

#define Klavesnica_PIN_MASK     ((byte)0x10) /* Pin mask */
#define klavesnicaTimeOut 200 //ms odstranenie zakmitov z tlacitok
void Klavesnica_Enable(void);
/*
** ===================================================================
**     Method      :  Klavesnica_Enable (component ExtInt)
**
**     Description :
**         Enable the component - the external events are accepted.
**         This method is available only if HW module allows
**         enable/disable of the interrupt.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/

#define Klavesnica_Disable() (clrReg8Bits(EPIER0,Klavesnica_PIN_MASK)) /* Disable interrupt "INT_EPORT0_EPF4" */
/*
** ===================================================================
**     Method      :  Klavesnica_Disable (component ExtInt)
**
**     Description :
**         Disable the component - the external events are not accepted.
**         This method is available only if HW module allows
**         enable/disable of the interrupt.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/

void Klavesnica_Interrupt(void);
/*
** ===================================================================
**     Method      :  Klavesnica_Interrupt (component ExtInt)
**
**     Description :
**         The method services the interrupt of the selected peripheral(s)
**         and invokes the components event.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/

#define Klavesnica_GetVal() ((bool)(getReg8(EPPDR0) & Klavesnica_PIN_MASK))
/*
** ===================================================================
**     Method      :  Klavesnica_GetVal (component ExtInt)
**
**     Description :
**         Returns the actual value of the input pin of the component.
**     Parameters  : None
**     Returns     :
**         ---             - Returned input value. Possible values:
**                           FALSE - logical "0" (Low level)
**                           TRUE - logical "1" (High level)
** ===================================================================
*/

/*
** ===================================================================
**     Method      :  KlavesnicaLow_GetVal (component BitsIO)
**
**     Description :
**         This method returns an input value.
**           a) direction = Input  : reads the input value from the
**                                   pins and returns it
**           b) direction = Output : returns the last written value
**         Note: This component is set to work in Input direction only.
**     Parameters  : None
**     Returns     :
**         ---        - Input value (0 to 3)
** ===================================================================
*/
byte KlavesnicaValue_GetVal(void);

#endif /* KLAVESNICA_H_ */
