Skip to main content

PWM Lib API

danger

this is a legacy library and thus not supported by Toradex anymore. We recommend that you use the new libraries for all Toradex modules. Please see the Toradex CE Libraries and Code Samples for up-to-date information.


Library to support Pulse Width Modulation (PWM)

Macros

##define PWM_VER_MAJ   2 Version Info.
#define PWM_VER_MIN   1#define PWM_VER_BUILD   2#define COLIBRI_PWM1   0#define COLIBRI_PWM2   1#define COLIBRI_PWM3   2#define COLIBRI_PWM4   3#define APALIS_PWM1   3#define APALIS_PWM2   2#define APALIS_PWM3   1#define APALIS_PWM4   0

Functions

void InitPWM (DWORD pwm, DWORD prescale, DWORD period)
void SetPWMDuty (DWORD pwm, DWORD duty)
void SetPWMDutyPercentage (DWORD pwm, DWORD duty)
void DeInitPWM (DWORD pwm)
void PWMGetLibVersion (DWORD *pVerMaj, DWORD *pVerMin, DWORD *pBuild)

Macro Definition Documentation

#define APALIS_PWM1   3
 
#define APALIS_PWM2   2
 
#define APALIS_PWM3   1
 
#define APALIS_PWM4   0
 
#define COLIBRI_PWM1   0
 
#define COLIBRI_PWM2   1
 
#define COLIBRI_PWM3   2
 
#define COLIBRI_PWM4   3
 
#define PWM_VER_BUILD   2
 
#define PWM_VER_MAJ   2
Version Info.
#define PWM_VER_MIN   1
 

Function Documentation

void DeInitPWM(DWORD pwm) 
Deinitialise PWM Controller
Parameters:
[in]pwm,:channel to use (0-3)
void InitPWM(DWORD pwm,
  DWORD prescale,
  DWORD period 
 )  
Initialise PWM Controller (0-3)
Parameters:
[in]prescale,:scale factor for the 13Mhz Clock (1-64)
[in]period,:period length in scaled clocks units. Note - This is fixed for Tegra 2 i.e. 256
void PWMGetLibVersion(DWORD * pVerMaj,
  DWORD * pVerMin,
  DWORD * pBuild 
 )  
get the library version
Parameters:
Out]pVerMaj Returns the major version number. Set this parameter to NULL if not required.
Out]pVerMin: Returns the minor version number. Set this parameter to NULL if not required.
Out]pBuild: Returns the build number. Set this parameter to NULL if not required.
void SetPWMDuty(DWORD pwm,
  DWORD duty 
 )  
Assign duty cycle in PWM Controller
Parameters:
[in]pwm,:channel to use (0-3)
[in]duty,:high time in scaled clocks units for each period i.e. 256
void SetPWMDutyPercentage(DWORD pwm,
  DWORD duty 
 )  
Assign percentage duty cycle in PWM Controller
Parameters:
[in]pwm,:channel to use (0-3)
[in]duty,:high time in percantage (0-100)


  • Macros
  • Functions
Send Feedback!