#include "gpio.h"


/*******************************************************************************/
/**
* \brief    InitPort - Inits port
* \author   RV
* \param    void
* \return   void
* \todo
*/
void InitPort(void){
  
/* PORTA Initialization */     
  PTADD_PTADD1 = 0;    //SW_CAR_LOCATION
  PTADD_PTADD2 = 0;    //SW_OPEN_TRUNK
  PTADD_PTADD3 = 0;    //SW_LOCK
  PTADD_PTADD5 = 0;    //SW_UNLOCK
  
  PTAPE_PTAPE1 = 1;    //SW_CAR_LOCATION
  PTAPE_PTAPE2 = 1;    //SW_OPEN_TRUNK
  PTAPE_PTAPE3 = 1;    //SW_LOCK
  PTAPE_PTAPE5 = 1;    //SW_UNLOCK
         
/* BKGD pin PTA4 function as a output only pin, connected with LED */
  PTAD_PTAD4   = 1;
  PTADD_PTADD4 = 1;
  
/* Manchester coding output port */  
  PTADD_PTADD0 = 1;
  PTADS_PTADS0 = 1;
  PTAD_PTAD0   = 0; 
/* end of PORT Initialization */  
}


/*******************************************************************************/
/**
* \brief    EnterStopMode - Proper configuration of MCU when enter into STOP mode
* \author   R66192
* \param    void
* \return   void
* \todo
*/
void EnterStopMode(void)
{

/* PORTA Initialization */     
  PTADD_PTADD1 = 0;    //SW_CAR_LOCATION
  PTADD_PTADD2 = 0;    //SW_OPEN_TRUNK
  PTADD_PTADD3 = 0;    //SW_LOCK
  PTADD_PTADD5 = 0;    //SW_UNLOCK
  
  PTAPE_PTAPE1 = 1;    //SW_CAR_LOCATION
  PTAPE_PTAPE2 = 1;    //SW_OPEN_TRUNK
  PTAPE_PTAPE3 = 1;    //SW_LOCK
  PTAPE_PTAPE5 = 1;    //SW_UNLOCK
         
/* BKGD pin PTA4 function as a output only pin */
  PTAD_PTAD4   = 1;
  PTADD_PTADD4 = 1;
  
/* Manchester coding output port */  
  PTADD_PTADD0 = 1;
  PTADS_PTADS0 = 1;
  PTAD_PTAD0   = 0;
  
/* Put unbonded PORTB into output state */    
    PTBD  = 0x0;
    PTBDD = 0xff;    
}