/*********************************************************************************************************************
* RT1064DVL6A Opensourec Library RT1064DVL6A Դ⣩һڹٷ SDK ӿڵĵԴ
* Copyright (c) 2022 SEEKFREE ɿƼ
* 
* ļ RT1064DVL6A Դһ
* 
* RT1064DVL6A Դ 
* Ըᷢ GPLGNU General Public License GNUͨù֤
*  GPL ĵ3棨 GPL3.0ѡģκκİ汾·/޸
* 
* Դķϣܷãδκεı֤
* ûԻʺض;ı֤
* ϸμ GPL
* 
* ӦյԴͬʱյһ GPL ĸ
* ûУ<https://www.gnu.org/licenses/>
* 
* ע
* Դʹ GPL3.0 Դ֤Э Ϊİ汾
* Ӣİ libraries/doc ļµ GPL3_permission_statement.txt ļ
* ֤ libraries ļ ļµ LICENSE ļ
* ӭλʹò ޸ʱ뱣ɿƼİȨ
* 
* ļ          zf_driver_pwm
* ˾          ɶɿƼ޹˾
* 汾Ϣ          鿴 libraries/doc ļ version ļ 汾˵
*           IAR 8.32.4 or MDK 5.33
* ƽ̨          RT1064DVL6A
*           https://seekfree.taobao.com/
* 
* ޸ļ¼
*                               ע
* 2022-09-21        SeekFree            first version
********************************************************************************************************************/

#ifndef _zf_driver_pwm_h_
#define _zf_driver_pwm_h_

#include "zf_common_typedef.h"

#define PWM_DUTY_MAX        (10000)                                                                     // PWMռձֵ ɸ޸

typedef enum                                                                                            // ö PWM ͨ öٶ岻û޸
{
    //ͬһģ鲻ֻͬͨͬƵʵPWMռձȿòͬ
    //PWM1_MODULE0_CHBPWM1_MODULE0_CHAͬһģ飬ƵֻһռձȿԲһ
    //PWM1_MODULE0_CHA_D12PWM1_MODULE1_CHA_D14ȻͬһPWMģ鵫ڲͬģͬƵʵPWM
    
    PWM1_MODULE0_CHB_D13=1*40+5*0,                                                                      // PWM1 ģ0 ͨB  ſѡΧ
    PWM1_MODULE0_CHA_D12=1*40+5*1,                                                                      // PWM1 ģ0 ͨA  ſѡΧ 
                                                                                                            
    PWM1_MODULE1_CHB_D15=1*40+5*2,                                                                      // PWM1 ģ1 ͨB  ſѡΧ
    PWM1_MODULE1_CHA_D14=1*40+5*3,                                                                      // PWM1 ģ1 ͨA  ſѡΧ
                                                                                                            
    PWM1_MODULE2_CHB_D17=1*40+5*4,                                                                      // PWM1 ģ2 ͨB  ſѡΧ
    PWM1_MODULE2_CHA_D16=1*40+5*5,                                                                      // PWM1 ģ2 ͨA  ſѡΧ

    PWM1_MODULE3_CHB_B11=1*40+5*6,  PWM1_MODULE3_CHB_C17,   PWM1_MODULE3_CHB_D1,                        // PWM1 ģ3 ͨB  ſѡΧ
    PWM1_MODULE3_CHA_B10=1*40+5*7,  PWM1_MODULE3_CHA_C16,   PWM1_MODULE3_CHA_D0,                        // PWM1 ģ3 ͨA  ſѡΧ
    
    //-----------------------------------------------------------------------------
    PWM2_MODULE0_CHB_C7 =2*40+5*0,                                                                      // PWM2 ģ0 ͨB  ſѡΧ
    PWM2_MODULE0_CHA_C6 =2*40+5*1,                                                                      // PWM2 ģ0 ͨA  ſѡΧ
                                                                                                            
    PWM2_MODULE1_CHB_C9 =2*40+5*2,                                                                      // PWM2 ģ1 ͨB  ſѡΧ
    PWM2_MODULE1_CHA_C8 =2*40+5*3,                                                                      // PWM2 ģ1 ͨA  ſѡΧ
                                                                                                            
    PWM2_MODULE2_CHB_C11=2*40+5*4,                                                                      // PWM2 ģ2 ͨB  ſѡΧ
    PWM2_MODULE2_CHA_C10=2*40+5*5,                                                                      // PWM2 ģ2 ͨA  ſѡΧ
                        
    PWM2_MODULE3_CHB_B1 =2*40+5*6,  PWM2_MODULE3_CHB_C19,   PWM2_MODULE3_CHB_D3,                        // PWM2 ģ3 ͨB  ſѡΧ
    PWM2_MODULE3_CHA_B0 =2*40+5*7,  PWM2_MODULE3_CHA_C18,   PWM2_MODULE3_CHA_D2,    PWM2_MODULE3_CHA_B9,// PWM2 ģ3 ͨA  ſѡΧ
    
    //-----------------------------------------------------------------------------
    //PWM3ģȫSDRAMռ
    
    //-----------------------------------------------------------------------------
    PWM4_MODULE0_CHA_B24=4*40+5*1,                                                                      // PWM4 ģ0 ͨA  ſѡΧ
                                                                                                           
    PWM4_MODULE1_CHA_B25=4*40+5*3,                                                                      // PWM4 ģ1 ͨA  ſѡΧ
                                                                                                           
    PWM4_MODULE2_CHA_C30=4*40+5*5,                                                                      // PWM4 ģ2 ͨA  ſѡΧ
                                                                                                           
    PWM4_MODULE3_CHA_C31=4*40+5*7,                                                                      // PWM4 ģ3 ͨA  ſѡΧ
}pwm_channel_enum;


void    pwm_set_duty    (pwm_channel_enum pin, const uint32 duty);
void    pwm_init        (pwm_channel_enum pin, const uint32 freq, const uint32 duty);

#endif
