#define  GLOBALS_API_PWM
#include "../App_Headers/includes.h"


/*--------------------------------------------------------------------------
* Function Name  : Api_PWM_Init
* Description    : 
* Input          : None
* Output         : None
* Return         : None
* onther         : qitiancun
--------------------------------------------------------------------------*/
void Api_PWM_Init(void)
{            
    PWME   =   Channel_1 ;
    PWMCLK =   Channel_1 ;         //通道 1 2 时钟选择
    PWMPOL = ~(Channel_1 );      
 
    PWMPRCLK = PWM_CLK_128DIV;   //时钟 = busclk / 32
    PWMCAE   = ~(Channel_1 );       //通道 1 0 左对称
    PWMCTL   = PWM_CTL;
    
    //PWMDTY0  = null;
    PWMDTY1  = null;
    //PWMDTY2  = null;
     
    PWMSCLA =  2; //255
    PWMSCLB =  2; //255
    //PWMPER0  = PWM0_CYCLE;       //PWM1 周期
    PWMPER1  = PWM1_CYCLE;       //PWM1 周期
    //PWMPER2  = PWM2_CYCLE;       //PWM2 周期       
}
/*-------------------------------------------------------------------------
* Function Name  : Api_BeepCtl
* Description    : 报警控制
* Input          : 
* Output         : None
* Return         : None
* onther         : 
Clock SA = Clock A / (2 * PWMSCLA)
Clock A = Bus/div1
--------------------------------------------------------------------------*/
void Api_BeepCtl(INT8U duty1,INT8U duty2,INT8U Cycle)
{    
    PWME_PWME1 = Enable;
    //PWME_PWME2 = Enable;  

    PWMPER1  = Cycle;       //PWM1 周期
   // PWMPER2  = Cycle;       //PWM2 周期     
    PWMDTY1  = duty1;
   // PWMDTY2  = duty2;
}
/*-------------------------------------------------------------------------
* Function Name  : Api_LightCtl
* Description    : 
* Input          : 
* Output         : None
* Return         : None
* onther         : 
Clock SA = Clock A / (2 * PWMSCLA)
Clock A = Bus/div1
--------------------------------------------------------------------------*/
void Api_LightCtl(INT8U duty,INT8U Cycle)
{        
  //  PWMPER0  = Cycle;       //PWM1 周期  
   // PWMDTY0  = duty;
}


