/*
 * $Author: b06900 $
 * $Date: 2008/03/05 22:48:43 $
 * $Name:  $
 */
 
//includes
#include "pub_def.h"
#include "board_config.h"
//Prototypes
void RadioInit(void);



#define HCS08Q    														/*!<HCS08QE128 family member*/
#define MC13192_CE              PTBD_PTBD5    /*!<Enables SPI transfers*/              
#define MC13192_CE_PORT         PTBDD_PTBDD5  /*!<SPI enable pin data direction */              
#define MC13192_ATTN            PTCD_PTCD1		/*!<Transitions IC from either Hibernate 
                                                  or Doze Modes to Idle.  */
#define MC13192_ATTN_PORT       PTCDD_PTCDD1  /*!<ATTN pin data direction  */
#define MC13192_RTXEN           PTCD_PTCD2		/*!<Enables Transmission or Reception from SPI  */
#define MC13192_RTXEN_PORT      PTCDD_PTCDD2  /*!<SPI Transmission pin direction */
#define MC13192_RESET           PTCD_PTCD0		/*!<Transciever Reset */
#define MC13192_RESET_PORT      PTCDD_PTCDD0  /*!<Transciever Reset pin data direction */
#define MC13192_RESET_PULLUP    PTCPE_PTCPE0  /*!<Enables pull up for Reset */
#define MC13192_IRQ_SOURCE      IRQSC					/*!<IRQ register */
#define MC13192_IRQ_IE_BIT      IRQSC_IRQIE		/*!<Enables IRQ pin */


/**************************************************************
Enable peripherials that are on the Board
**************************************************************/

#define ACCEL_ENABLED         FALSE
#define TEMP_SENSOR_ENABLED   FALSE
#define BUZZER_ENABLED        TRUE
#define BUS_SPEED	            8000000

/**************************************************************
Define the SCI perameters
**************************************************************/
#if (DEFAULT_SCI_PORT == 1)
   #define  SCIBDH     SCI1BDH
   #define  SCIBDL     SCI1BDL
   #define  SCIC1      SCI1C1 
   #define  SCIC2      SCI1C2 
   #define  SCIS1      SCI1S1 
   #define  SCIS2      SCI1S2 
   #define  SCIC3      SCI1C3 
   #define  SCID       SCI1D

   #define  SCIS1_TDRE  SCI1S1_TDRE
   #define  SCIS1_TC    SCI1S1_TC

   #define  RTS			   PTFD_PTFD7
   #define  RTSDIR		 PTFDD_PTFDD7
   
#else 

   #define  SCIBDH     SCI2BDH
   #define  SCIBDL     SCI2BDL
   #define  SCIC1      SCI2C1 
   #define  SCIC2      SCI2C2 
   #define  SCIS1      SCI2S1 
   #define  SCIS2      SCI2S2 
   #define  SCIC3      SCI2C3 
   #define  SCID       SCI2D
   
   #define  RTS			PTFD_PTFD7
   #define  RTSDIR		PTFDD_PTFDD7
   
   #define  SCIS1_TDRE  SCI2S1_TDRE
   #define  SCIS1_TC    SCI2S1_TC

#endif 
#define  SCI_DEFAULT_BAUD  38400

/**************************************************************
Define the LED perameters
**************************************************************/

#define LED1                    PTED_PTED3
#define LED1DIR                 PTEDD_PTEDD3
#define LED2                    PTED_PTED4
#define LED2DIR                 PTEDD_PTEDD4
#define LED3                    PTED_PTED5
#define LED3DIR                 PTEDD_PTEDD5
#define LED4                    PTED_PTED6
#define LED4DIR                 PTEDD_PTEDD6


    
#define LED_ON                  0
#define LED_OFF					        1
#define DDIR_OUTPUT             1
#define DDIR_INPUT              0
    
#define LED_INIT_MACRO LED1     = LED_OFF; \
                       LED2     = LED_OFF; \
                       LED3     = LED_OFF; \
                       LED4     = LED_OFF; \
                       LED5     = LED_OFF; \
                       LED1DIR  = DDIR_OUTPUT; \
                       LED2DIR  = DDIR_OUTPUT; \
                       LED3DIR  = DDIR_OUTPUT; \
                       LED4DIR  = DDIR_OUTPUT; \
                       LED5DIR  = DDIR_OUTPUT;        
    
/***********************************************
Define Buzzer
***********************************************/
    
    
#define BUZZER         PTED_PTED2
#define BUZZERDIR      PTEDD_PTEDD2
#define BUZZER_ON      1
#define BUZZER_OFF     0
   
#define BUZZER_INIT_MACRO BUZZER      = BUZZER_OFF; \
                          BUZZERDIR   = DDIR_OUTPUT;
    
/***********************************************
Define Switches
***********************************************/
    
    
/* SW1 on schematic */
#define PB0 PTDD_PTDD0
#define PB0PU PTDPE_PTDPE0
#define PB0DIR PTDDD_PTDDD0
#define PB0IE KBI2PE_KBIPE0
  
/* SW2 on schematic */
#define PB1 PTDD_PTDD1
#define PB1PU PTDPE_PTDPE1
#define PB1DIR PTDDD_PTDDD1
#define PB1IE KBI2PE_KBIPE1
   
/* SW3 on schematic */
#define PB2 PTDD_PTDD2
#define PB2PU PTDPE_PTDPE2
#define PB2DIR PTDDD_PTDDD2
#define PB2IE KBI2PE_KBIPE2
  
/* SW4 on schematic */
#define PB3 PTDD_PTDD3
#define PB3PU PTDPE_PTDPE3
#define PB3DIR PTDDD_PTDDD3
#define PB3IE KBI2PE_KBIPE3

/* Define the KBI switch bit positions */
#define KBI_SW1 0x01
#define KBI_SW2 0x02
#define KBI_SW3 0x04
#define KBI_SW4 0x08

#define SWITCH_INIT_MACRO    PB0PU = TRUE; \
                             PB1PU = TRUE; \
                             PB2PU = TRUE; \
                             PB3PU = TRUE; \
                             PB0DIR = FALSE;\
                             PB1DIR = FALSE;\
                             PB2DIR = FALSE;\
                             PB3DIR = FALSE;
    
/***********************************************
LCD Settings
***********************************************/
                             
#define LCD_ENABLE        /* None Dip Switch */
#define LCD_REG_SEL       PTDD_PTDD5
#define LCD_EN            PTDD_PTDD6
#define LCD_RW            PTDD_PTDD7
    /* Data bits are 4-7 */
#define LCD_DATA1         PTFD_PTFD4
#define LCD_DATA2         PTFD_PTFD5
#define LCD_DATA3         PTFD_PTFD6
#define LCD_DATA4         PTFD_PTFD7
#define LCD_INIT_MACRO    PTFDD = 0xF0; \
                          PTDDD |= 0xE0;
                                                                                                                   
#define ENTER_LOW_POWER _asm stop

/***********************************************
Duplicate PB0 to PUSH_BUTTON1 etc for different
formats.
***********************************************/

#define PUSH_BUTTON1 PB0
#define PUSH_BUTTON2 PB1
#define PUSH_BUTTON3 PB2
#define PUSH_BUTTON4 PB3

#define PB_PRESSED 0
