//*****************************************************************************
//*****************************************************************************
//  FILENAME: QP0B.h
//   Version: 2.3, Updated on 2004/07/29 at 17:41:18
//  Generated by PSoC Designer ver 4.2  b1013 : 02 September, 2004
//
//  DESCRIPTION: Counter8 User Module C Language interface file
//               for the 22/24/27/29xxx PSoC family of devices
//-----------------------------------------------------------------------------
//  Copyright (c) Cypress MicroSystems 2000-2004. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************

#include <m8c.h>

#pragma fastcall16 QP0B_EnableInt
#pragma fastcall16 QP0B_DisableInt
#pragma fastcall16 QP0B_Start
#pragma fastcall16 QP0B_Stop
#pragma fastcall16 QP0B_bReadCounter              // Read  DR0
#pragma fastcall16 QP0B_WritePeriod               // Write DR1
#pragma fastcall16 QP0B_bReadCompareValue         // Read  DR2
#pragma fastcall16 QP0B_WriteCompareValue         // Write DR2

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


//-------------------------------------------------
// Prototypes of the QP0B API.
//-------------------------------------------------

extern void QP0B_EnableInt(void);                           // Proxy Class 1
extern void QP0B_DisableInt(void);                          // Proxy Class 1
extern void QP0B_Start(void);                               // Proxy Class 1
extern void QP0B_Stop(void);                                // Proxy Class 1
extern BYTE QP0B_bReadCounter(void);                        // Proxy Class 1
extern void QP0B_WritePeriod(BYTE bPeriod);                 // Proxy Class 1
extern BYTE QP0B_bReadCompareValue(void);                   // Proxy Class 2
extern void QP0B_WriteCompareValue(BYTE bCompareValue);     // Proxy Class 1

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


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

#define QP0B_CONTROL_REG_START_BIT             ( 0x01 )
#define QP0B_INT_REG_ADDR                      ( 0x0df )
#define QP0B_INT_MASK                          ( 0x20 )


//--------------------------------------------------
// Constants for QP0B user defined values
//--------------------------------------------------

#define QP0B_PERIOD                            ( 0xff )
#define QP0B_COMPARE_VALUE                     ( 0x00 )


//-------------------------------------------------
// Register Addresses for QP0B
//-------------------------------------------------

#pragma ioport  QP0B_COUNTER_REG:   0x054                  //DR0 Count register
BYTE            QP0B_COUNTER_REG;
#pragma ioport  QP0B_PERIOD_REG:    0x055                  //DR1 Period register
BYTE            QP0B_PERIOD_REG;
#pragma ioport  QP0B_COMPARE_REG:   0x056                  //DR2 Compare register
BYTE            QP0B_COMPARE_REG;
#pragma ioport  QP0B_CONTROL_REG:   0x057                  //Control register
BYTE            QP0B_CONTROL_REG;
#pragma ioport  QP0B_FUNC_REG:  0x154                      //Function register
BYTE            QP0B_FUNC_REG;
#pragma ioport  QP0B_INPUT_REG: 0x155                      //Input register
BYTE            QP0B_INPUT_REG;
#pragma ioport  QP0B_OUTPUT_REG:    0x156                  //Output register
BYTE            QP0B_OUTPUT_REG;
#pragma ioport  QP0B_INT_REG:       0x0df                  //Interrupt Mask Register
BYTE            QP0B_INT_REG;


//-------------------------------------------------
// QP0B Macro 'Functions'
//-------------------------------------------------

#define QP0B_Start_M \
   QP0B_CONTROL_REG |=  QP0B_CONTROL_REG_START_BIT

#define QP0B_Stop_M  \
   QP0B_CONTROL_REG &= ~QP0B_CONTROL_REG_START_BIT

#define QP0B_EnableInt_M   \
   M8C_EnableIntMask(QP0B_INT_REG, QP0B_INT_MASK)

#define QP0B_DisableInt_M  \
   M8C_DisableIntMask(QP0B_INT_REG, QP0B_INT_MASK)


// end of file QP0B.h
