//*****************************************************************************
//*****************************************************************************
//  FILENAME: PWM8_B.h
//   Version: 2.5, Updated on 2010/4/6 at 11:27:32
//  Generated by PSoC Designer 
//
//  DESCRIPTION: PWM8 User Module C Language interface file
//-----------------------------------------------------------------------------
//  Copyright (c) Cypress Semiconductor 2010. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************
#ifndef PWM8_B_INCLUDE
#define PWM8_B_INCLUDE

#include <m8c.h>

#pragma fastcall16 PWM8_B_EnableInt
#pragma fastcall16 PWM8_B_DisableInt
#pragma fastcall16 PWM8_B_Start
#pragma fastcall16 PWM8_B_Stop
#pragma fastcall16 PWM8_B_bReadCounter              // Read  DR0
#pragma fastcall16 PWM8_B_WritePeriod               // Write DR1
#pragma fastcall16 PWM8_B_bReadPulseWidth           // Read  DR2
#pragma fastcall16 PWM8_B_WritePulseWidth           // Write DR2

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


//-------------------------------------------------
// Prototypes of the PWM8_B API.
//-------------------------------------------------

extern void PWM8_B_EnableInt(void);                        // Proxy Class 1
extern void PWM8_B_DisableInt(void);                       // Proxy Class 1
extern void PWM8_B_Start(void);                            // Proxy Class 1
extern void PWM8_B_Stop(void);                             // Proxy Class 1
extern BYTE PWM8_B_bReadCounter(void);                     // Proxy Class 2
extern void PWM8_B_WritePeriod(BYTE bPeriod);              // Proxy Class 1
extern BYTE PWM8_B_bReadPulseWidth(void);                  // Proxy Class 1
extern void PWM8_B_WritePulseWidth(BYTE bPulseWidth);      // Proxy Class 1

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


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

#define PWM8_B_CONTROL_REG_START_BIT           ( 0x01 )
#define PWM8_B_INT_REG_ADDR                    ( 0x0e1 )
#define PWM8_B_INT_MASK                        ( 0x04 )


//--------------------------------------------------
// Constants for PWM8_B user defined values
//--------------------------------------------------

#define PWM8_B_PERIOD                          ( 0x00 )
#define PWM8_B_PULSE_WIDTH                     ( 0x00 )


//-------------------------------------------------
// Register Addresses for PWM8_B
//-------------------------------------------------

#pragma ioport  PWM8_B_COUNTER_REG: 0x028                  //DR0 Count register
BYTE            PWM8_B_COUNTER_REG;
#pragma ioport  PWM8_B_PERIOD_REG:  0x029                  //DR1 Period register
BYTE            PWM8_B_PERIOD_REG;
#pragma ioport  PWM8_B_COMPARE_REG: 0x02a                  //DR2 Compare register
BYTE            PWM8_B_COMPARE_REG;
#pragma ioport  PWM8_B_CONTROL_REG: 0x02b                  //Control register
BYTE            PWM8_B_CONTROL_REG;
#pragma ioport  PWM8_B_FUNC_REG:    0x128                  //Function register
BYTE            PWM8_B_FUNC_REG;
#pragma ioport  PWM8_B_INPUT_REG:   0x129                  //Input register
BYTE            PWM8_B_INPUT_REG;
#pragma ioport  PWM8_B_OUTPUT_REG:  0x12a                  //Output register
BYTE            PWM8_B_OUTPUT_REG;
#pragma ioport  PWM8_B_INT_REG:       0x0e1                //Interrupt Mask Register
BYTE            PWM8_B_INT_REG;


//-------------------------------------------------
// PWM8_B Macro 'Functions'
//-------------------------------------------------

#define PWM8_B_Start_M \
   PWM8_B_CONTROL_REG |=  PWM8_B_CONTROL_REG_START_BIT

#define PWM8_B_Stop_M  \
   PWM8_B_CONTROL_REG &= ~PWM8_B_CONTROL_REG_START_BIT

#define PWM8_B_EnableInt_M   \
   M8C_EnableIntMask(PWM8_B_INT_REG, PWM8_B_INT_MASK)

#define PWM8_B_DisableInt_M  \
   M8C_DisableIntMask(PWM8_B_INT_REG, PWM8_B_INT_MASK)

#endif
// end of file PWM8_B.h
