/** ###################################################################
**     THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : CSyncEn.C
**     Project   : vga2scart
**     Processor : MC9S08QD4CPC
**     Component : BitIO
**     Version   : Component 02.075, Driver 03.21, CPU db: 3.00.002
**     Compiler  : CodeWarrior HCS08 C Compiler
**     Date/Time : 6.7.2010, 22:59
**     Abstract  :
**         This bean "BitIO" implements an one-bit input/output.
**         It uses one bit/pin of a port.
**         Methods of this bean are mostly implemented as a macros
**         (if supported by target language and compiler).
**     Settings  :
**         Used pin                    :
**             ----------------------------------------------------
**                Number (on package)  |    Name
**             ----------------------------------------------------
**                       5             |  PTA3_KBI1P3_TCLK2_ADC1P3
**             ----------------------------------------------------
**
**         Port name                   : PTA
**
**         Bit number (in port)        : 3
**         Bit mask of the port        : $0008
**
**         Initial direction           : Input (direction can be changed)
**         Safe mode                   : yes
**         Initial output value        : 0
**         Initial pull option         : off
**
**         Port data register          : PTAD      [$0000]
**         Port control register       : PTADD     [$0001]
**
**         Optimization for            : speed
**     Contents  :
**         SetDir - void CSyncEn_SetDir(bool Dir);
**         GetVal - bool CSyncEn_GetVal(void);
**         PutVal - void CSyncEn_PutVal(bool Val);
**         ClrVal - void CSyncEn_ClrVal(void);
**         SetVal - void CSyncEn_SetVal(void);
**
**     Copyright : 1997 - 2009 Freescale Semiconductor, Inc. All Rights Reserved.
**     
**     http      : www.freescale.com
**     mail      : support@freescale.com
** ###################################################################*/

/* MODULE CSyncEn. */

#include "CSyncEn.h"
  /* Including shared modules, which are used in the whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "Cpu.h"


/*
** ===================================================================
**     Method      :  CSyncEn_GetVal (component BitIO)
**
**     Description :
**         This method returns an input value.
**           a) direction = Input  : reads the input value from the
**                                   pin and returns it
**           b) direction = Output : returns the last written value
**     Parameters  : None
**     Returns     :
**         ---             - Input value. Possible values:
**                           FALSE - logical "0" (Low level)
**                           TRUE - logical "1" (High level)

** ===================================================================
*/
/*
bool CSyncEn_GetVal(void)

**  This method is implemented as a macro. See CSyncEn.h file.  **
*/

/*
** ===================================================================
**     Method      :  CSyncEn_PutVal (component BitIO)
**
**     Description :
**         This method writes the new output value.
**           a) direction = Input  : sets the new output value;
**                                   this operation will be shown on
**                                   output after the direction has
**                                   been switched to output
**                                   (SetDir(TRUE);)
**           b) direction = Output : directly writes the value to the
**                                   appropriate pin
**     Parameters  :
**         NAME       - DESCRIPTION
**         Val             - Output value. Possible values:
**                           FALSE - logical "0" (Low level)
**                           TRUE - logical "1" (High level)
**     Returns     : Nothing
** ===================================================================
*/
void CSyncEn_PutVal(bool Val)
{
  if (Val) {
    setReg8Bits(PTAD, 0x08);           /* PTAD3=0x01 */
    Shadow_PTA |= (byte)0x08;          /* Set-up shadow variable */
  } else { /* !Val */
    clrReg8Bits(PTAD, 0x08);           /* PTAD3=0x00 */
    Shadow_PTA &= (byte)~0x08;         /* Set-up shadow variable */
  } /* !Val */
}

/*
** ===================================================================
**     Method      :  CSyncEn_ClrVal (component BitIO)
**
**     Description :
**         This method clears (sets to zero) the output value.
**           a) direction = Input  : sets the output value to "0";
**                                   this operation will be shown on
**                                   output after the direction has
**                                   been switched to output
**                                   (SetDir(TRUE);)
**           b) direction = Output : directly writes "0" to the
**                                   appropriate pin
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
/*
void CSyncEn_ClrVal(void)

**  This method is implemented as a macro. See CSyncEn.h file.  **
*/

/*
** ===================================================================
**     Method      :  CSyncEn_SetVal (component BitIO)
**
**     Description :
**         This method sets (sets to one) the output value.
**           a) direction = Input  : sets the output value to "1";
**                                   this operation will be shown on
**                                   output after the direction has
**                                   been switched to output
**                                   (SetDir(TRUE);)
**           b) direction = Output : directly writes "1" to the
**                                   appropriate pin
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
/*
void CSyncEn_SetVal(void)

**  This method is implemented as a macro. See CSyncEn.h file.  **
*/

/*
** ===================================================================
**     Method      :  CSyncEn_SetDir (component BitIO)
**
**     Description :
**         This method sets direction of the bean.
**     Parameters  :
**         NAME       - DESCRIPTION
**         Dir        - Direction to set (FALSE or TRUE)
**                      FALSE = Input, TRUE = Output
**     Returns     : Nothing
** ===================================================================
*/
void CSyncEn_SetDir(bool Dir)
{
  if (Dir) {
    setReg8(PTAD, (getReg8(PTAD) & (~0x08)) | (Shadow_PTA & 0x08)); /* PTAD3=Shadow_PTA[bit 3] */
    setReg8Bits(PTADD, 0x08);          /* PTADD3=0x01 */
  } else { /* !Dir */
    clrReg8Bits(PTADD, 0x08);          /* PTADD3=0x00 */
  } /* !Dir */
}


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