/** ###################################################################
**     THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : VSync.H
**     Project   : vga2scart
**     Processor : MC9S08QD4CPC
**     Component : Capture
**     Version   : Component 02.211, Driver 01.27, CPU db: 3.00.002
**     Compiler  : CodeWarrior HCS08 C Compiler
**     Date/Time : 7.7.2010, 0:50
**     Abstract  :
**         This bean "Capture" simply implements the capture function
**         of timer. The counter counts the same way as in free run mode. On
**         the selected edge of the input signal (on the input pin), the current
**         content of the counter register is written into the capture
**         register and the OnCapture event is called.
**     Settings  :
**             Timer capture encapsulation : Capture
**
**         Timer
**             Timer                   : TPM1
**             Counter shared          : Yes
**
**         High speed mode
**             Prescaler               : divide-by-1
**           Maximal time for capture register
**             Xtal ticks              : 256
**             microseconds            : 8192
**             milliseconds            : 8
**             seconds (real)          : 0.008192
**             Hz                      : 122
**           One tick of timer is
**             nanoseconds             : 125
**
**         Initialization:
**              Timer                  : Enabled
**              Events                 : Enabled
**
**         Timer registers
**              Capture                : TPMC0V    [$0046]
**              Counter                : TPMCNT    [$0041]
**              Mode                   : TPMSC     [$0040]
**              Run                    : TPMSC     [$0040]
**              Prescaler              : TPMSC     [$0040]
**
**         Used input pin              : 
**             ----------------------------------------------------
**                Number (on package)  |    Name
**             ----------------------------------------------------
**                       8             |  PTA0_KBI1P0_TPM1CH0_ADC1P0
**             ----------------------------------------------------
**
**         Port name                   : PTA
**         Bit number (in port)        : 0
**         Bit mask of the port        : $0001
**
**         Signal edge/level           : falling
**         Pull option                 : up
**
**     Contents  :
**         GetCaptureValue - byte VSync_GetCaptureValue(VSync_TCapturedValue *Value);
**         GetPinValue     - bool VSync_GetPinValue(void);
**
**     Copyright : 1997 - 2009 Freescale Semiconductor, Inc. All Rights Reserved.
**     
**     http      : www.freescale.com
**     mail      : support@freescale.com
** ###################################################################*/

#ifndef __VSync
#define __VSync

/*Include shared modules, which are used for whole project*/
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"

/* MODULE VSync. */

#include "Cpu.h"

/* PUBLISHED CONSTANTS */
#define VSync_PRESCALER_VALUE           0x01U /* Prescaler value of the timer in high speed mode */
#define VSync_COUNTER_INPUT_CLOCK_HZ    0x007A1200LU /* Initial counter input clock frequency [Hz] */
#define VSync_TIMER_INPUT_CLOCK         0x007A1200LU /* Deprecated, Initial timer input clock frequency [Hz] */
#define VSync_PRESCALER_VALUE_HIGH      0x01U /* Prescaler value of the timer in high speed mode */
#define VSync_COUNTER_INPUT_CLOCK_HZ_HIGH 0x007A1200LU /* Counter input clock frequency in high speed mode [Hz] */
#define VSync_TIMER_INPUT_CLOCK_HIGH    0x007A1200LU /* Deprecated, Timer input clock frequency in high speed mode[Hz] */

#ifndef __BWUserType_VSync_TCapturedValue
#define __BWUserType_VSync_TCapturedValue
  #define VSync_TCapturedValue word    /* Type of the captured value */
#endif



#define VSync_GetCaptureValue(Value) \
  (*(VSync_TCapturedValue*)(Value) = (VSync_TCapturedValue)TPMC0V , (byte)ERR_OK)
/*
** ===================================================================
**     Method      :  VSync_GetCaptureValue (component Capture)
**
**     Description :
**         This method gets the last value captured by enabled timer.
**         Note: one tick of timer is
**               125 ns in high speed mode
**     Parameters  :
**         NAME            - DESCRIPTION
**       * Value           - A pointer to the content of the
**                           capture register
**     Returns     :
**         ---             - Error code, possible codes:
**                           ERR_OK - OK
**                           ERR_SPEED - This device does not work in
**                           the active speed mode
** ===================================================================
*/

#define VSync_GetPinValue() ((bool)(PTAD & 0x01))
/*
** ===================================================================
**     Method      :  VSync_GetPinValue (component Capture)
**
**     Description :
**         The method reads the Capture pin value. The method is
**         available only if it is possible to read the pin value
**         (usually not available for internal signals).
**     Parameters  : None
**     Returns     :
**         ---             - Capture pin value.
**                           <true> - high level
**                           <false> - low level.
** ===================================================================
*/

void VSync_Init(void);
/*
** ===================================================================
**     Method      :  VSync_Init (component Capture)
**
**     Description :
**         Initializes the associated peripheral(s) and the bean internal 
**         variables. The method is called automatically as a part of the 
**         application initialization code.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/


/* END VSync. */

#endif /* ifndef __VSync */
/*
** ###################################################################
**
**     This file was created by Processor Expert 3.07 [04.34]
**     for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
