/*
*******************************************************************************
COPYRIGHT 2002 STMicroelectronics
Source File Name : pwmart.h
Group            : IPSW,CMG-IPDF.
Author           : MCD Application Team
Date First Issued:  5/03/2002      
********************************Documentation**********************************
General Purpose - This file defines prototypes for all the functions which are 
				  defined in pwmart.c
********************************RevisionHistory********************************
_______________________________________________________________________________
Date : 5/03/2002    Release : 1.0  	
Date : 23/9/2003    Release : 2.0
                    1.Updated for ST72561 device. 
                    2.Changed multiple inclusion protection symbol
                    3.Changed Pwmart_Clock values to load the enum value 
                      directly in the register     
       01/06/2004   Release : 2.1
                    1.Changed for MISRA compliance                      
*******************************************************************************/
#ifndef PWMART_H
#define PWMART_H    

#include "ST7lib_config.h"
                 
/*----------------------------------------------------------------------------*/
                              /* Enum parameters for the function PWMART_Init */
typedef enum {
              PWMART_DEFAULT           = (unsigned char) 0x00,
              PWMART_EXCLK             = (unsigned char) 0x80, 
              PWMART_OVF_IT_ENABLE     = (unsigned char) 0x02
             }Typ_Pwmart_InitParameter;

/*----------------------------------------------------------------------------*/
                        /* Enum parameters for function PWMART_Counter_Enable */
typedef enum {
              PWMART_REG_CAR,
              PWMART_REG_ARR
             } Pwmart_Counter;

/*----------------------------------------------------------------------------*/
  /* Enum parameters for functions PWMART_Counter_Enable,PWMART_OCMP_Timebase */
typedef enum {
              PWMART_CLK_1             = (unsigned char) 0x00,  
              PWMART_CLK_2             = (unsigned char) 0x10, 
              PWMART_CLK_4             = (unsigned char) 0x20, 
              PWMART_CLK_8             = (unsigned char) 0x30,
              PWMART_CLK_16            = (unsigned char) 0x40,
              PWMART_CLK_32            = (unsigned char) 0x50,
              PWMART_CLK_64            = (unsigned char) 0x60,
              PWMART_CLK_128           = (unsigned char) 0x70
             } Pwmart_Clock;
	      	
/*----------------------------------------------------------------------------*/  
     /* Enum parameters for the function PWMART_Status_Flag,PWMART_Clear_Flag */
typedef enum {
              PWMART_FLAG_ICF1,
              PWMART_FLAG_ICF2,
              PWMART_FLAG_OVF
             } Pwmart_Flag;   

/*----------------------------------------------------------------------------*/
         /* Enum parameters for the function PWMART_OCMP_Mode,PWMART_PWM_Mode */
#if (defined PWMART_72F521 || defined PWMART_72F561)
typedef enum {
              PWMART_0 = 0,                   
              PWMART_1 = 1,	
              PWMART_2 = 2,	
              PWMART_3 = 3,	 
              PWMART_OCMP_0 = 0, 
              PWMART_OCMP_1 = 1,
              PWMART_OCMP_2 = 2,
              PWMART_OCMP_3 = 3	
             } Pwmart_Compare,Pwmart_Pwm; 
#endif /* PWMART_72F521, PWMART_72F561 */ 
#ifdef PWMART_72F62
typedef enum {
              PWMART_0 ,                  
              PWMART_1 ,
              PWMART_OCMP_0, 
              PWMART_OCMP_1
             } Pwmart_Compare,Pwmart_Pwm; 
#endif /* PWMART_72F62 */
/*----------------------------------------------------------------------------*/
                         /* Enum parameters for the function PWMART_ICAP_Mode */
typedef enum {
              PWMART_ICAP_1,
              PWMART_ICAP_2 
             } Pwmart_Icap;                                                                

/*----------------------------------------------------------------------------*/   
         /* Enum parameters for the function PWMART_OCMP_Mode,PWMART_PWM_Mode */
typedef enum { 
              PWMART_POLARITY_0,
              PWMART_POLARITY_1
             } Pwmart_Output;                                                                

/*----------------------------------------------------------------------------*/
                         /* Enum parameters for the function PWMART_ICAP_Mode */
typedef enum { 
              PWMART_SENSITIVITY_F     = (unsigned char) 0x00,                         
              PWMART_SENSITIVITY_R     = (unsigned char) 0x10,
              PWMART_ICAP1_IT_ENABLE   = (unsigned char) 0x04,            
              PWMART_ICAP2_IT_ENABLE   = (unsigned char) 0x04
             } Pwmart_Sens_IT_Param;        

/*----------------------------------------------------------------------------*/
                      /* Enum parameters for the function PWMART_Mode_Disable */
#if (defined PWMART_72F521 || defined PWMART_72F561)
typedef enum { 
              PWMART_OVF_IT_DISABLE,                 /* Disable OVF interrupt */
              PWMART_ICAP1_IT_DISABLE,             /* Disable ICAP1 interrupt */
              PWMART_ICAP2_IT_DISABLE,             /* Disable ICAP2 interrupt */
              PWMART_COUNTER_DISABLE,               /* Disable PWMART counter */
              PWMART_PWM0_DISABLE,                     /* Disable PWM0 output */
              PWMART_PWM1_DISABLE,                     /* Disable PWM1 output */
              PWMART_PWM2_DISABLE,                     /* Disable PWM2 output */
              PWMART_PWM3_DISABLE                      /* Disable PWM3 output */
             } Pwmart_Dparam;        
#endif /* PWMART_72F521, PWMART_72F561 */ 
#ifdef PWMART_72F62
typedef enum { 
              PWMART_OVF_IT_DISABLE,                 /* Disable OVF interrupt */
              PWMART_ICAP1_IT_DISABLE,             /* Disable ICAP1 interrupt */
              PWMART_ICAP2_IT_DISABLE,             /* Disable ICAP2 interrupt */
              PWMART_COUNTER_DISABLE,               /* Disable PWMART counter */
              PWMART_PWM0_DISABLE,                     /* Disable PWM0 output */
              PWMART_PWM1_DISABLE                      /* Disable PWM1 output */
             } Pwmart_Dparam;        
#endif /* PWMART_72F62 */

/*----------------------------------------------------------------------------*/
#if (defined PWMART_72F521 || defined PWMART_72F62 || defined PWMART_72F561)
                    /* Declaration of all the functions with their prototypes */

void PWMART_Init(Typ_Pwmart_InitParameter InitValue);   /* Initialise PWMART  */
                                /* Enablle counter and select clock prescalar */
void PWMART_Counter_Enable(Pwmart_Counter SELECT_REG,unsigned char Counter_Data,
                                                    Pwmart_Clock SELECT_CLK);
                                            /*  PWMART in Output compate Mode */
void PWMART_OCMP_Mode(Pwmart_Compare OCMP,Pwmart_Output POLARITY,
                                                 unsigned char Compare_Data);
                                    /* PWMART in output compare Timebase Mode */
void PWMART_OCMP_Timebase(double Tinput,double Time,Pwmart_Clock SELECT_CLK);
                                                        /* PWMART in PWM Mode */
void PWMART_PWM_Mode(Pwmart_Pwm SELECT_Pin,Pwmart_Output POLARITY,
                                               unsigned char Dutycycle_Data);
                                              /* PWMART in Input Capture Mode */
void PWMART_ICAP_Mode(Pwmart_Icap ICAP_I,Pwmart_Sens_IT_Param SENS_IT_Value);
                                               /* Get the last captured value */
unsigned char PWMART_ICAP_Getvalue(Pwmart_Icap ICAP_I);
BOOL PWMART_Status_Flag(Pwmart_Flag FLAG_F);    /* Get the status of the flag */
void PWMART_Clear_Flag(Pwmart_Flag FLAG_F);          /* Clear the status flag */
void PWMART_Mode_Disable(Pwmart_Dparam MODE);          /* Disable PWMART Mode */
#endif /* PWMART_72F521, PWMART_72F62, PWMART_72F561 */

#endif /* PWMART_H */

/**********   (c) 2002  ST Microelectronics **************END OF FILE ********/
