NANO100_BSP V3.04.002
The Board Support Package for Nano100BN Series
Macros | Functions
Collaboration diagram for PWM Exported Functions:

Macros

#define PWM_ENABLE_OUTPUT_INVERTER(pwm, u32ChannelMask)
 This macro enable output inverter of specified channel(s) More...
 
#define PWM_GET_CAPTURE_RISING_DATA(pwm, u32ChannelNum)
 This macro get captured rising data. More...
 
#define PWM_GET_CAPTURE_FALLING_DATA(pwm, u32ChannelNum)
 This macro get captured falling data. More...
 
#define PWM_SET_PRESCALER(pwm, u32ChannelNum, u32Prescaler)
 This macro set the prescaler of the selected channel. More...
 
#define PWM_SET_DIVIDER(pwm, u32ChannelNum, u32Divider)
 This macro set the divider of the selected channel. More...
 
#define PWM_SET_CMR(pwm, u32ChannelNum, u32CMR)
 This macro set the duty of the selected channel. More...
 
#define PWM_SET_CNR(pwm, u32ChannelNum, u32CNR)
 This macro set the period of the selected channel. More...
 

Functions

uint32_t PWM_ConfigOutputChannel (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Frequency, uint32_t u32DutyCycle)
 This function config PWM generator and get the nearest frequency in edge aligned auto-reload mode. More...
 
uint32_t PWM_ConfigCaptureChannel (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32UnitTimeNsec, uint32_t u32CaptureEdge)
 This function config PWM capture and get the nearest unit time. More...
 
void PWM_Start (PWM_T *pwm, uint32_t u32ChannelMask)
 This function start PWM module. More...
 
void PWM_Stop (PWM_T *pwm, uint32_t u32ChannelMask)
 This function stop PWM module. More...
 
void PWM_ForceStop (PWM_T *pwm, uint32_t u32ChannelMask)
 This function stop PWM generation immediately by clear channel enable bit. More...
 
void PWM_EnableCapture (PWM_T *pwm, uint32_t u32ChannelMask)
 This function enables PWM capture of selected channels. More...
 
void PWM_DisableCapture (PWM_T *pwm, uint32_t u32ChannelMask)
 This function disables PWM capture of selected channels. More...
 
void PWM_EnableOutput (PWM_T *pwm, uint32_t u32ChannelMask)
 This function enables PWM output generation of selected channels. More...
 
void PWM_DisableOutput (PWM_T *pwm, uint32_t u32ChannelMask)
 This function disables PWM output generation of selected channels. More...
 
void PWM_EnableDeadZone (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Duration)
 This function enable Dead zone of selected channel. More...
 
void PWM_DisableDeadZone (PWM_T *pwm, uint32_t u32ChannelNum)
 This function disable Dead zone of selected channel. More...
 
void PWM_EnableCaptureInt (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge)
 This function enable capture interrupt of selected channel. More...
 
void PWM_DisableCaptureInt (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge)
 This function disable capture interrupt of selected channel. More...
 
void PWM_ClearCaptureIntFlag (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Edge)
 This function clear capture interrupt flag of selected channel. More...
 
uint32_t PWM_GetCaptureIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function get capture interrupt flag of selected channel. More...
 
void PWM_EnablePeriodInt (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntPeriodType)
 This function enable period interrupt of selected channel. More...
 
void PWM_DisablePeriodInt (PWM_T *pwm, uint32_t u32ChannelNum)
 This function disable period interrupt of selected channel. More...
 
void PWM_ClearPeriodIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function clear period interrupt of selected channel. More...
 
uint32_t PWM_GetPeriodIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
 This function get period interrupt of selected channel. More...
 
void PWM_EnablePDMA (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32RisingFirst, uint32_t u32Mode)
 This function enable capture PDMA of selected channel. More...
 
void PWM_DisablePDMA (PWM_T *pwm, uint32_t u32ChannelNum)
 This function disable capture PDMA of selected channel. More...
 

Detailed Description

Macro Definition Documentation

◆ PWM_ENABLE_OUTPUT_INVERTER

#define PWM_ENABLE_OUTPUT_INVERTER (   pwm,
  u32ChannelMask 
)

This macro enable output inverter of specified channel(s)

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel Bit 0 represents channel 0, bit 1 represents channel 1...
Returns
None

Definition at line 75 of file pwm.h.

◆ PWM_GET_CAPTURE_FALLING_DATA

#define PWM_GET_CAPTURE_FALLING_DATA (   pwm,
  u32ChannelNum 
)

This macro get captured falling data.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
None

Definition at line 103 of file pwm.h.

◆ PWM_GET_CAPTURE_RISING_DATA

#define PWM_GET_CAPTURE_RISING_DATA (   pwm,
  u32ChannelNum 
)

This macro get captured rising data.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
None

Definition at line 94 of file pwm.h.

◆ PWM_SET_CMR

#define PWM_SET_CMR (   pwm,
  u32ChannelNum,
  u32CMR 
)

This macro set the duty of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32CMRDuty of specified channel. Valid values are between 0~0xFFFF
Returns
None
Note
This new setting will take effect on next PWM period

Definition at line 143 of file pwm.h.

◆ PWM_SET_CNR

#define PWM_SET_CNR (   pwm,
  u32ChannelNum,
  u32CNR 
)

This macro set the period of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32CNRPeriod of specified channel. Valid values are between 0~0xFFFF
Returns
None
Note
This new setting will take effect on next PWM period
PWM counter will stop if period length set to 0

Definition at line 159 of file pwm.h.

◆ PWM_SET_DIVIDER

#define PWM_SET_DIVIDER (   pwm,
  u32ChannelNum,
  u32Divider 
)

This macro set the divider of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32DividerClock divider of specified channel. Valid values are
Returns
None

Definition at line 131 of file pwm.h.

◆ PWM_SET_PRESCALER

#define PWM_SET_PRESCALER (   pwm,
  u32ChannelNum,
  u32Prescaler 
)

This macro set the prescaler of the selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32PrescalerClock prescaler of specified channel. Valid values are between 1 ~ 0xFF
Returns
None
Note
Every even channel N, and channel (N + 1) share a prescaler. So if channel 0 prescaler changed, channel 1 will also be affected.

Definition at line 115 of file pwm.h.

Function Documentation

◆ PWM_ClearCaptureIntFlag()

void PWM_ClearCaptureIntFlag ( PWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32Edge 
)

This function clear capture interrupt flag of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32EdgeCapture interrupt type. It could be either
Returns
None

Definition at line 425 of file pwm.c.

◆ PWM_ClearPeriodIntFlag()

void PWM_ClearPeriodIntFlag ( PWM_T pwm,
uint32_t  u32ChannelNum 
)

This function clear period interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
None

Definition at line 477 of file pwm.c.

◆ PWM_ConfigCaptureChannel()

uint32_t PWM_ConfigCaptureChannel ( PWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32UnitTimeNsec,
uint32_t  u32CaptureEdge 
)

This function config PWM capture and get the nearest unit time.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32UnitTimeNsecUnit time of counter
[in]u32CaptureEdgeCondition to latch the counter
Returns
Nearest unit time in nano second
Note
Since every two channels, (0 & 1), (2 & 3), (4 & 5), shares a prescaler. Call this API to configure PWM frequency may affect existing frequency of other channel.

Definition at line 142 of file pwm.c.

◆ PWM_ConfigOutputChannel()

uint32_t PWM_ConfigOutputChannel ( PWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32Frequency,
uint32_t  u32DutyCycle 
)

This function config PWM generator and get the nearest frequency in edge aligned auto-reload mode.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32FrequencyTarget generator frequency
[in]u32DutyCycleTarget generator duty cycle percentage. Valid range are between 0 ~ 100. 10 means 10%, 20 means 20%...
Returns
Nearest frequency clock in nano second
Note
Since every two channels, (0 & 1), (2 & 3), (4 & 5), shares a prescaler. Call this API to configure PWM frequency may affect existing frequency of other channel.

Definition at line 37 of file pwm.c.

Here is the caller graph for this function:

◆ PWM_DisableCapture()

void PWM_DisableCapture ( PWM_T pwm,
uint32_t  u32ChannelMask 
)

This function disables PWM capture of selected channels.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel. Set bit 0 to 1 enables channel 0 output, set bit 1 to 1 enables channel 1 output...
Returns
None

Definition at line 308 of file pwm.c.

◆ PWM_DisableCaptureInt()

void PWM_DisableCaptureInt ( PWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32Edge 
)

This function disable capture interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32EdgeCapture interrupt type. It could be either
Returns
None

Definition at line 409 of file pwm.c.

◆ PWM_DisableDeadZone()

void PWM_DisableDeadZone ( PWM_T pwm,
uint32_t  u32ChannelNum 
)

This function disable Dead zone of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
None

Definition at line 375 of file pwm.c.

◆ PWM_DisableOutput()

void PWM_DisableOutput ( PWM_T pwm,
uint32_t  u32ChannelMask 
)

This function disables PWM output generation of selected channels.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel Set bit 0 to 1 disables channel 0 output, set bit 1 to 1 disables channel 1 output...
Returns
None

Definition at line 346 of file pwm.c.

Here is the caller graph for this function:

◆ PWM_DisablePDMA()

void PWM_DisablePDMA ( PWM_T pwm,
uint32_t  u32ChannelNum 
)

This function disable capture PDMA of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are 0 and 2
Returns
None

Definition at line 523 of file pwm.c.

◆ PWM_DisablePeriodInt()

void PWM_DisablePeriodInt ( PWM_T pwm,
uint32_t  u32ChannelNum 
)

This function disable period interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
None

Definition at line 466 of file pwm.c.

◆ PWM_EnableCapture()

void PWM_EnableCapture ( PWM_T pwm,
uint32_t  u32ChannelMask 
)

This function enables PWM capture of selected channels.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel. Set bit 0 to 1 enables channel 0 output, set bit 1 to 1 enables channel 1 output...
Returns
None

Definition at line 285 of file pwm.c.

Here is the caller graph for this function:

◆ PWM_EnableCaptureInt()

void PWM_EnableCaptureInt ( PWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32Edge 
)

This function enable capture interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32EdgeCapture interrupt type. It could be either
Returns
None

Definition at line 393 of file pwm.c.

Here is the caller graph for this function:

◆ PWM_EnableDeadZone()

void PWM_EnableDeadZone ( PWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32Duration 
)

This function enable Dead zone of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32DurationDead Zone length in PWM clock count, valid values are between 0~0xFF, but 0 means there is no dead zone.
Returns
None

Definition at line 359 of file pwm.c.

◆ PWM_EnableOutput()

void PWM_EnableOutput ( PWM_T pwm,
uint32_t  u32ChannelMask 
)

This function enables PWM output generation of selected channels.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel. Set bit 0 to 1 enables channel 0 output, set bit 1 to 1 enables channel 1 output...
Returns
None

Definition at line 334 of file pwm.c.

Here is the caller graph for this function:

◆ PWM_EnablePDMA()

void PWM_EnablePDMA ( PWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32RisingFirst,
uint32_t  u32Mode 
)

This function enable capture PDMA of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are 0 and 2
[in]u32RisingFirstOrder of captured data transferred by PDMA. It could be either
[in]u32ModeCaptured data transferred by PDMA interrupt type. It could be either
Returns
None

Definition at line 509 of file pwm.c.

◆ PWM_EnablePeriodInt()

void PWM_EnablePeriodInt ( PWM_T pwm,
uint32_t  u32ChannelNum,
uint32_t  u32IntPeriodType 
)

This function enable period interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
[in]u32IntPeriodTypeThis parameter is not used
Returns
None
Note
All channels share the same period interrupt type setting.

Definition at line 454 of file pwm.c.

◆ PWM_ForceStop()

void PWM_ForceStop ( PWM_T pwm,
uint32_t  u32ChannelMask 
)

This function stop PWM generation immediately by clear channel enable bit.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel. Bit 0 is channel 0, bit 1 is channel 1...
Returns
None

Definition at line 268 of file pwm.c.

◆ PWM_GetCaptureIntFlag()

uint32_t PWM_GetCaptureIntFlag ( PWM_T pwm,
uint32_t  u32ChannelNum 
)

This function get capture interrupt flag of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
Capture interrupt flag of specified channel
Return values
0Capture interrupt did not occurred
PWM_RISING_LATCH_INT_FLAGRising edge latch interrupt occurred
PWM_FALLING_LATCH_INT_FLAGFalling edge latch interrupt occurred
PWM_RISING_FALLING_LATCH_INT_FLAGRising and falling edge latch interrupt occurred

Definition at line 441 of file pwm.c.

◆ PWM_GetPeriodIntFlag()

uint32_t PWM_GetPeriodIntFlag ( PWM_T pwm,
uint32_t  u32ChannelNum 
)

This function get period interrupt of selected channel.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelNumPWM channel number. Valid values are between 0~5
Returns
Period interrupt flag of specified channel
Return values
0Period interrupt did not occurred
1Period interrupt occurred

Definition at line 491 of file pwm.c.

◆ PWM_Start()

void PWM_Start ( PWM_T pwm,
uint32_t  u32ChannelMask 
)

This function start PWM module.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel. Bit 0 is channel 0, bit 1 is channel 1...
Returns
None

Definition at line 227 of file pwm.c.

Here is the caller graph for this function:

◆ PWM_Stop()

void PWM_Stop ( PWM_T pwm,
uint32_t  u32ChannelMask 
)

This function stop PWM module.

Parameters
[in]pwmThe base address of PWM module
[in]u32ChannelMaskCombination of enabled channels. Each bit corresponds to a channel. Bit 0 is channel 0, bit 1 is channel 1...
Returns
None

Definition at line 248 of file pwm.c.