/*
*******************************************************************************
COPYRIGHT 2003 STMicroelectronics
Source File Name : timer8.h
Group            : IPSW,CMG-IPDF.
Author           : MCD Application Team
Date First Issued: 23/9/2003
********************************Documentation**********************************
General Purpose - This file defines prototypes for all the functions whose 
				  source code appears in timer8.c
********************************RevisionHistory********************************
_______________________________________________________________________________
Date :23/9/2002 	       Release:2.0
Date :28/04/04                 MISRA changes               
******************************************************************************/
#ifndef TIMER8_H
#define TIMER8_H     

#include "ST7lib_config.h"
                
/*---------------------------------------------------------------------------*/
/* Enumerated parameters for the function TIMER8_Init                        */
typedef enum {
              TIMER8_DEFAULT   = (unsigned char) 0x00,/*Default configuration*/
              TIMER8_FCPU_2    = (unsigned char) 0x04,/*Timer8CLK = Fcpu/2   */
              TIMER8_FCPU_4    = (unsigned char) 0x00,/*Timer8CLK = Fcpu/4   */
              TIMER8_FCPU_8    = (unsigned char) 0x08,/* Timer8CLK = Fcpu/8  */
              TIMER8_FCPU_8000 = (unsigned char) 0x0c/*Timer8CLK = Fcpu/8000 */
             }Typ_Timer8_InitParameter;

/*---------------------------------------------------------------------------*/
/* Enumerated parameters for the function TIMER8_IT_Enable                   */
typedef enum {
              TIMER8_OCMP_IT_ENABLE = (unsigned char) 0x40, /* Enable CMP int*/
              TIMER8_ICAP_IT_ENABLE = (unsigned char) 0x80, /* Enable CAP int*/
              TIMER8_OVF_IT_ENABLE  = (unsigned char) 0x20  /* Enable OVF int*/ 	           
             }Typ_Timer8_EITParameter;

/*---------------------------------------------------------------------------*/
/* Enumerated parameters for the function TIMER8_IT_Disable                  */
typedef enum {
              TIMER8_OCMP_IT_DISABLE = (unsigned char) 0x40,/*Disable CMP int*/
              TIMER8_ICAP_IT_DISABLE = (unsigned char) 0x80,/*Disable CAP int*/
              TIMER8_OVF_IT_DISABLE  = (unsigned char) 0x20 /*Disable OVF int*/
             }Typ_Timer8_DITParameter;
	      	
/*---------------------------------------------------------------------------*/
/* Enumerated parameters for function TIMER8_Status_Flag,TIMER8_Clear_Flag   */
typedef enum {
                                                /* For Output compare 1 Flag */
              TIMER8_FLAG_OCF1       = (unsigned char) 0x40,
                                                /* For Output compare 2 Flag */
              TIMER8_FLAG_OCF2       = (unsigned char) 0x08,
                                                /*  For Input Capture 1 Flag */
              TIMER8_FLAG_ICF1       = (unsigned char) 0x80,
                                                /*  For Input Capture 2 Flag */
              TIMER8_FLAG_ICF2       = (unsigned char) 0x10,
                                                /*         For Overflow Flag */
              TIMER8_FLAG_OVF        = (unsigned char) 0x20  
             }Timer8_Flag;   

/*---------------------------------------------------------------------------*/
/* Enumerated parameters for function TIMER8_OCMP_Mode                       */
typedef enum {                
              TIMER8_OCMP_1,                          /* For ouput compare 1 */
              TIMER8_OCMP_2,                          /* For ouput compare 2 */
              TIMER8_FORCDCMP_1,                     /* For Forced compare 1 */
              TIMER8_FORCDCMP_2                       /* For ouput compare 2 */
             }Timer8_Compare; 

/*---------------------------------------------------------------------------*/
/* Enumerated parameters for function TIMER8_PWM_Mode and TIMER8_OCMP_Mode   */

typedef enum {
              TIMER8_OUTPUT_F,                         /* OLVL1 or OLVL2 = 0 */     
              TIMER8_OUTPUT_R,                         /* OLVL1 or OLVL2 = 1 */
              TIMER8_OUTPUT1_F,                                 /* OLVL1 = 0 */
              TIMER8_OUTPUT1_R,                                 /* OLVL1 = 1 */
              TIMER8_OUTPUT2_F,                                 /* OLVL2 = 0 */
              TIMER8_OUTPUT2_R                                  /* OLVL2 = 1 */
             }Timer8_Olevel;                                                              

/*---------------------------------------------------------------------------*/
/* Enumerated parameters for function TIMER8_ICAP_Mode,TIMER8_ICAP_Getvalue  */
typedef enum {
              TIMER8_ICAP_1,                          /* For Input Capture 1 */
              TIMER8_ICAP_2                           /* For Input Capture 2 */
             }Timer8_Icap;                                                                

/*---------------------------------------------------------------------------*/
/* Enumerated parameters for function TIMER8_ICAP_Mode                       */
typedef enum {
               TIMER8_EDGE_0,                     /* To detect trailing edge */
               TIMER8_EDGE_1                        /* To detect rising edge */
             }Timer8_Edge;                                                                

/*---------------------------------------------------------------------------*/
/* Enumerated parameters for function TIMER8_Mode_Disable                    */
typedef enum { 
              TIMER8_MODE_1,                        /* To disable OCMP1 mode */
              TIMER8_MODE_2,                        /* To disable OCMP2 mode */
              TIMER8_MODE_3,                        /* To disable ICAP1 mode */
              TIMER8_MODE_4,                        /* To disable ICAP2 mode */
              TIMER8_MODE_5,                          /* To disable PWM mode */
              TIMER8_MODE_6,                          /* To disable OPM mode */
              TIMER8_MODE_7,                         /* To disable FORCDCMP1 */
              TIMER8_MODE_8,                         /* To disable FORCDCMP2 */
              TIMER8_MODE_9  /* Disable timer8 prescalar,counter and outputs */
             }Timer8_Mode;

/*---------------------------------------------------------------------------*/

                                                        /* Macro declaration */
                                            /*  Enable timer8 interrupts     */
#define TIMER8_IT_Enable(EITValue)  (T8CR1 |= (EITValue))
                                              /*   Disable timer8 interrupts */
#define TIMER8_IT_Disable(DITValue) (T8CR1 &= (unsigned char)(~(DITValue))) 

                                                      /* Function Prototypes */

void TIMER8_Init(Typ_Timer8_InitParameter InitValue); /* Initialises TIMER8  */
/*                Enables TIMER8 in the Output compare mode                  */
void TIMER8_OCMP_Mode(Timer8_Compare CMP,unsigned char TIMER8_OCR_VALUE,
                                                       Timer8_Olevel OUTPUT_L);
                                                        /* Enables ICAP mode */
void TIMER8_ICAP_Mode(Timer8_Icap ICAP_I,Timer8_Edge EDGE_SELECT_Y); 
                                                  /* Get Input Capture value */                                                          
unsigned char TIMER8_ICAP_Getvalue(Timer8_Icap ICAP_I); 
/*                 Enables TIMER8 in the PWM mode                            */
void TIMER8_PWM_Mode(Timer8_Olevel OUTPUT1_L,Timer8_Olevel OUTPUT2_L,
              unsigned char TIMER8_OCR1_VALUE,unsigned char TIMER8_OCR2_VALUE);
/*               Enables TIMER8 in the One Pulse Mode                        */
void TIMER8_OPM_Mode(Timer8_Edge EDGE_SELECT_Y,Timer8_Olevel OUTPUT1_L,
                      Timer8_Olevel OUTPUT2_L, unsigned char TIMER8_OCR_VALUE);
BOOL TIMER8_Status_Flag(Timer8_Flag FLAG_F);    /* Checks status of the flag */
void TIMER8_Clear_Flag(Timer8_Flag FLAG_F);      /* Clears the required flag */
void TIMER8_Mode_Disable(Timer8_Mode MODE_M);               /* Disables mode */

#endif /* TIMER8_H */
/**********   (c) 2002  ST Microelectronics **************END OF FILE ********/
