//*****************************************************************************
//*****************************************************************************
//  FILENAME: Counter8.h
//   Version: 2.60, Updated on 2012/3/2 at 9:13:11
//  Generated by PSoC Designer 5.2.2551
//
//  DESCRIPTION: Counter8 User Module C Language interface file
//-----------------------------------------------------------------------------
//  Copyright (c) Cypress Semiconductor 2012. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************
#ifndef Counter8_INCLUDE
#define Counter8_INCLUDE

#include <m8c.h>

#pragma fastcall16 Counter8_EnableInt
#pragma fastcall16 Counter8_DisableInt
#pragma fastcall16 Counter8_Start
#pragma fastcall16 Counter8_Stop
#pragma fastcall16 Counter8_bReadCounter              // Read  DR0
#pragma fastcall16 Counter8_WritePeriod               // Write DR1
#pragma fastcall16 Counter8_bReadCompareValue         // Read  DR2
#pragma fastcall16 Counter8_WriteCompareValue         // Write DR2

// The following symbols are deprecated.
// They may be omitted in future releases
//
#pragma fastcall16 bCounter8_ReadCounter              // Read  DR0 (Deprecated)
#pragma fastcall16 bCounter8_ReadCompareValue         // Read  DR2 (Deprecated)


//-------------------------------------------------
// Prototypes of the Counter8 API.
//-------------------------------------------------

extern void Counter8_EnableInt(void);                           // Proxy Class 1
extern void Counter8_DisableInt(void);                          // Proxy Class 1
extern void Counter8_Start(void);                               // Proxy Class 1
extern void Counter8_Stop(void);                                // Proxy Class 1
extern BYTE Counter8_bReadCounter(void);                        // Proxy Class 1
extern void Counter8_WritePeriod(BYTE bPeriod);                 // Proxy Class 1
extern BYTE Counter8_bReadCompareValue(void);                   // Proxy Class 2
extern void Counter8_WriteCompareValue(BYTE bCompareValue);     // Proxy Class 1

// The following functions are deprecated.
// They may be omitted in future releases
//
extern BYTE bCounter8_ReadCounter(void);            // Deprecated
extern BYTE bCounter8_ReadCompareValue(void);       // Deprecated


//--------------------------------------------------
// Constants for Counter8 API's.
//--------------------------------------------------

#define Counter8_CONTROL_REG_START_BIT         ( 0x01 )
#define Counter8_INT_REG_ADDR                  ( 0x0e1 )
#define Counter8_INT_MASK                      ( 0x01 )


//--------------------------------------------------
// Constants for Counter8 user defined values
//--------------------------------------------------

#define Counter8_PERIOD                        ( 0x9b )
#define Counter8_COMPARE_VALUE                 ( 0x4e )


//-------------------------------------------------
// Register Addresses for Counter8
//-------------------------------------------------

#pragma ioport  Counter8_COUNTER_REG:   0x020              //DR0 Count register
BYTE            Counter8_COUNTER_REG;
#pragma ioport  Counter8_PERIOD_REG:    0x021              //DR1 Period register
BYTE            Counter8_PERIOD_REG;
#pragma ioport  Counter8_COMPARE_REG:   0x022              //DR2 Compare register
BYTE            Counter8_COMPARE_REG;
#pragma ioport  Counter8_CONTROL_REG:   0x023              //Control register
BYTE            Counter8_CONTROL_REG;
#pragma ioport  Counter8_FUNC_REG:  0x120                  //Function register
BYTE            Counter8_FUNC_REG;
#pragma ioport  Counter8_INPUT_REG: 0x121                  //Input register
BYTE            Counter8_INPUT_REG;
#pragma ioport  Counter8_OUTPUT_REG:    0x122              //Output register
BYTE            Counter8_OUTPUT_REG;
#pragma ioport  Counter8_INT_REG:       0x0e1              //Interrupt Mask Register
BYTE            Counter8_INT_REG;


//-------------------------------------------------
// Counter8 Macro 'Functions'
//-------------------------------------------------

#define Counter8_Start_M \
   Counter8_CONTROL_REG |=  Counter8_CONTROL_REG_START_BIT

#define Counter8_Stop_M  \
   Counter8_CONTROL_REG &= ~Counter8_CONTROL_REG_START_BIT

#define Counter8_EnableInt_M   \
   M8C_EnableIntMask(Counter8_INT_REG, Counter8_INT_MASK)

#define Counter8_DisableInt_M  \
   M8C_DisableIntMask(Counter8_INT_REG, Counter8_INT_MASK)

#endif
// end of file Counter8.h
