| NUC472_NUC442_BSP V3.04.000 The Board Support Package for NUC472/NUC442

Macros | Functions
PWM Exported Functions
NUC472/NUC442 Device Driver » PWM Driver » PWM Exported Constants
Collaboration diagram for PWM Exported Functions:

## Macros
#define | PWM_ENABLE_COMPLEMENTARY_MODE(pwm)
| This macro enable complementary mode. More...
#define | PWM_DISABLE_COMPLEMENTARY_MODE(pwm)
| This macro disable complementary mode, and enable independent mode. More...
#define | PWM_ENABLE_GROUP_MODE(pwm)
| This macro enable group mode. More...
#define | PWM_DISABLE_GROUP_MODE(pwm)
| This macro disable group mode. More...
#define | PWM_ENABLE_SYNC_MODE(pwm)
| This macro enable synchronous mode. More...
#define | PWM_DISABLE_SYNC_MODE(pwm)
| This macro disable synchronous mode, and enable independent mode. More...
#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_MASK_OUTPUT(pwm, u32ChannelMask, u32LevelMask)
| This macro mask output output logic to high or low. 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...
#define | PWM_SET_ALIGNED_TYPE(pwm, u32ChannelMask, u32AlignedType)
| This macro set the PWM aligned type. 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_EnableADCTrigger (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Condition)
| This function enable selected channel to trigger ADC. More...
void | PWM_DisableADCTrigger (PWM_T *pwm, uint32_t u32ChannelNum)
| This function disable selected channel to trigger ADC. More...
void | PWM_ClearADCTriggerFlag (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32Condition)
| This function clear selected channel trigger ADC flag. More...
uint32_t | PWM_GetADCTriggerFlag (PWM_T *pwm, uint32_t u32ChannelNum)
| This function get selected channel trigger ADC flag. More...
void | PWM_EnableFaultBrake (PWM_T *pwm, uint32_t u32ChannelMask, uint32_t u32LevelMask, uint32_t u32BrakeSource)
| This function enable fault brake of selected channels. More...
void | PWM_ClearFaultBrakeFlag (PWM_T *pwm, uint32_t u32BrakeSource)
| This function clear fault brake flag. 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_EnableDutyInt (PWM_T *pwm, uint32_t u32ChannelNum, uint32_t u32IntDutyType)
| This function enable duty interrupt of selected channel. More...
void | PWM_DisableDutyInt (PWM_T *pwm, uint32_t u32ChannelNum)
| This function disable duty interrupt of selected channel. More...
void | PWM_ClearDutyIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
| This function clears duty interrupt flag of selected channel. More...
uint32_t | PWM_GetDutyIntFlag (PWM_T *pwm, uint32_t u32ChannelNum)
| This function get duty interrupt flag of selected channel. More...
void | PWM_EnableFaultBrakeInt (PWM_T *pwm, uint32_t u32BrakeSource)
| This function enable fault brake interrupt. More...
void | PWM_DisableFaultBrakeInt (PWM_T *pwm, uint32_t u32BrakeSource)
| This function disable fault brake interrupt. More...
void | PWM_ClearFaultBrakeIntFlag (PWM_T *pwm, uint32_t u32BrakeSource)
| This function clear fault brake interrupt of selected source. More...
uint32_t | PWM_GetFaultBrakeIntFlag (PWM_T *pwm, uint32_t u32BrakeSource)
| This function get fault brake interrupt of selected source. 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...

## Detailed Description

## Macro Definition Documentation

## ◆ PWM_DISABLE_COMPLEMENTARY_MODE

#define PWM_DISABLE_COMPLEMENTARY_MODE | ( |  | pwm | ) |

This macro disable complementary mode, and enable independent mode.

Parameters

  [in] | pwm | The base address of PWM module

Returns
  None

Definition at line 101 of file pwm.h.

## ◆ PWM_DISABLE_GROUP_MODE

#define PWM_DISABLE_GROUP_MODE | ( |  | pwm | ) |

This macro disable group mode.

Parameters

  [in] | pwm | The base address of PWM module

Returns
  None

Definition at line 117 of file pwm.h.

## ◆ PWM_DISABLE_SYNC_MODE

#define PWM_DISABLE_SYNC_MODE | ( |  | pwm | ) |

This macro disable synchronous mode, and enable independent mode.

Parameters

  [in] | pwm | The base address of PWM module

Returns
  None

Definition at line 133 of file pwm.h.

## ◆ PWM_ENABLE_COMPLEMENTARY_MODE

#define PWM_ENABLE_COMPLEMENTARY_MODE | ( |  | pwm | ) |

This macro enable complementary mode.

Parameters

  [in] | pwm | The base address of PWM module

Returns
  None

Definition at line 93 of file pwm.h.

## ◆ PWM_ENABLE_GROUP_MODE

#define PWM_ENABLE_GROUP_MODE | ( |  | pwm | ) |

This macro enable group mode.

Parameters

  [in] | pwm | The base address of PWM module

Returns
  None

Definition at line 109 of file pwm.h.

## ◆ PWM_ENABLE_OUTPUT_INVERTER

#define PWM_ENABLE_OUTPUT_INVERTER | ( |  | pwm,
|  |  | u32ChannelMask
| ) |  |

This macro enable output inverter of specified channel(s)

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination of enabled channels. Each bit corresponds to a channel Bit 0 represents channel 0, bit 1 represents channel 1...

Returns
  None

Definition at line 143 of file pwm.h.

## ◆ PWM_ENABLE_SYNC_MODE

#define PWM_ENABLE_SYNC_MODE | ( |  | pwm | ) |

This macro enable synchronous mode.

Parameters

  [in] | pwm | The base address of PWM module

Returns
  None

Definition at line 125 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  None

Definition at line 161 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  None

Definition at line 152 of file pwm.h.

## ◆ PWM_MASK_OUTPUT

#define PWM_MASK_OUTPUT | ( |  | pwm,
|  |  | u32ChannelMask,
|  |  | u32LevelMask
| ) |  |

This macro mask output output logic to high or low.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination of enabled channels. Each bit corresponds to a channel Bit 0 represents channel 0, bit 1 represents channel 1...
  [in] | u32LevelMask | Output logic to high or low

Returns
  None

Definition at line 172 of file pwm.h.

## ◆ PWM_SET_ALIGNED_TYPE

#define PWM_SET_ALIGNED_TYPE | ( |  | pwm,
|  |  | u32ChannelMask,
|  |  | u32AlignedType
| ) |  |

This macro set the PWM aligned type.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination of enabled channels. Each bit corresponds to a channel Bit 0 represents channel 0, bit 1 represents channel 1...
  [in] | u32AlignedType | PWM aligned type, valid values are: PWM_EDGE_ALIGNED PWM_CENTER_ALIGNED

Returns
  None

Definition at line 241 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32CMR | Duty 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 216 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32CNR | Period 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 228 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32Divider | Clock divider of specified channel. Valid values are PWM_CLK_DIV_1 PWM_CLK_DIV_2 PWM_CLK_DIV_4 PWM_CLK_DIV_8 PWM_CLK_DIV_16

Returns
  None

Definition at line 204 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32Prescaler | Clock 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 188 of file pwm.h.

## Function Documentation

## ◆ PWM_ClearADCTriggerFlag()

void PWM_ClearADCTriggerFlag | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelNum,
|  | uint32_t | u32Condition
| ) |  |

This function clear selected channel trigger ADC flag.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32Condition | PWM triggered ADC flag to be cleared. A combination of following flags: PWM_TRIGGER_ADC_PERIOD_POINT PWM_TRIGGER_ADC_CENTER_POINT PWM_TRIGGER_ADC_FALLING_EDGE_POINT PWM_TRIGGER_ADC_RISING_EDGE_POINT

Returns
  None

Definition at line 442 of file pwm.c.

## ◆ 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32Edge | Capture interrupt type. It could be either PWM_FALLING_LATCH_INT_ENABLE PWM_RISING_LATCH_INT_ENABLE PWM_RISING_FALLING_LATCH_INT_ENABLE

Returns
  None

Definition at line 644 of file pwm.c.

## ◆ PWM_ClearDutyIntFlag()

void PWM_ClearDutyIntFlag | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelNum
| ) |  |

This function clears duty interrupt flag of selected channel.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  None

Definition at line 699 of file pwm.c.

## ◆ PWM_ClearFaultBrakeFlag()

void PWM_ClearFaultBrakeFlag | ( | PWM_T * | pwm,
|  | uint32_t | u32BrakeSource
| ) |  |

This function clear fault brake flag.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32BrakeSource | Fault brake source 0 or 1 0: brake 0, 1: brake 1

Returns
  None

Note
  After fault brake occurred, application must clear fault brake source before re-enable PWM output

Definition at line 511 of file pwm.c.

## ◆ PWM_ClearFaultBrakeIntFlag()

void PWM_ClearFaultBrakeIntFlag | ( | PWM_T * | pwm,
|  | uint32_t | u32BrakeSource
| ) |  |

This function clear fault brake interrupt of selected source.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32BrakeSource | Fault brake source, could be either PWM_INTSTS_BRKIF0_Msk, or PWM_INTSTS_BRKIF1_Msk

Returns
  None

Definition at line 748 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  None

Definition at line 803 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32UnitTimeNsec | Unit time of counter
  [in] | u32CaptureEdge | Condition 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 207 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32Frequency | Target generator frequency
  [in] | u32DutyCycle | Target 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.

## ◆ PWM_DisableADCTrigger()

void PWM_DisableADCTrigger | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelNum
| ) |  |

This function disable selected channel to trigger ADC.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  None

Definition at line 423 of file pwm.c.

## ◆ PWM_DisableCapture()

void PWM_DisableCapture | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelMask
| ) |  |

This function disables PWM capture of selected channels.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination 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 540 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32Edge | Capture interrupt type. It could be either PWM_FALLING_LATCH_INT_ENABLE PWM_RISING_LATCH_INT_ENABLE PWM_RISING_FALLING_LATCH_INT_ENABLE

Returns
  None

Definition at line 628 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  None

Definition at line 594 of file pwm.c.

## ◆ PWM_DisableDutyInt()

void PWM_DisableDutyInt | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelNum
| ) |  |

This function disable duty interrupt of selected channel.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  None

Definition at line 688 of file pwm.c.

## ◆ PWM_DisableFaultBrakeInt()

void PWM_DisableFaultBrakeInt | ( | PWM_T * | pwm,
|  | uint32_t | u32BrakeSource
| ) |  |

This function disable fault brake interrupt.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32BrakeSource | This parameter is not used

Returns
  None

Definition at line 735 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] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination 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 565 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  None

Definition at line 792 of file pwm.c.

## ◆ PWM_EnableADCTrigger()

void PWM_EnableADCTrigger | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelNum,
|  | uint32_t | u32Condition
| ) |  |

This function enable selected channel to trigger ADC.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32Condition | The condition to trigger ADC. Combination of following conditions: PWM_TRIGGER_ADC_PERIOD_POINT PWM_TRIGGER_ADC_CENTER_POINT PWM_TRIGGER_ADC_FALLING_EDGE_POINT PWM_TRIGGER_ADC_RISING_EDGE_POINT

Returns
  None

Definition at line 409 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] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination 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 526 of file pwm.c.

## ◆ PWM_EnableCaptureInt()

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

This function enable capture interrupt of selected channel.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32Edge | Capture interrupt type. It could be either PWM_FALLING_LATCH_INT_ENABLE PWM_RISING_LATCH_INT_ENABLE PWM_RISING_FALLING_LATCH_INT_ENABLE

Returns
  None

Definition at line 612 of file pwm.c.

## ◆ PWM_EnableDeadZone()

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

This function enable Dead zone of selected channel.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32Duration | Dead 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 578 of file pwm.c.

## ◆ PWM_EnableDutyInt()

void PWM_EnableDutyInt | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelNum,
|  | uint32_t | u32IntDutyType
| ) |  |

This function enable duty interrupt of selected channel.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32IntDutyType | Duty interrupt type. It could be either PWM_DUTY_INT_MATCH_CMR_UP PWM_DUTY_INT_MATCH_CMR_DN

Returns
  None

Definition at line 674 of file pwm.c.

## ◆ PWM_EnableFaultBrake()

void PWM_EnableFaultBrake | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelMask,
|  | uint32_t | u32LevelMask,
|  | uint32_t | u32BrakeSource
| ) |  |

This function enable fault brake of selected channels.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelMask | This parameter is not used
  [in] | u32LevelMask | Output high or low while fault brake occurs, each bit represent the level of a channel while fault brake occurs. Bit 0 represents channel 0, bit 1 represents channel 1... , bit 6 represent D6, and bit 7 represents D7
  [in] | u32BrakeSource | Fault brake source, could be one of following source PWM_BRK0_BKP0 PWM_BRK0_CPO0 PWM_BRK0_CPO1 PWM_BRK0_CPO2 PWM_BRK1_LVDBK PWM_BK1SEL_BKP1 PWM_BK1SEL_CPO0 PWM_BK1SEL_CPO1

Returns
  None

Definition at line 487 of file pwm.c.

## ◆ PWM_EnableFaultBrakeInt()

void PWM_EnableFaultBrakeInt | ( | PWM_T * | pwm,
|  | uint32_t | u32BrakeSource
| ) |  |

This function enable fault brake interrupt.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32BrakeSource | This parameter is not used

Returns
  None

Definition at line 724 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] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination 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 553 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5
  [in] | u32IntPeriodType | Period interrupt type, could be either PWM_PERIOD_INT_UNDERFLOW PWM_PERIOD_INT_MATCH_CNR

Returns
  None

Note
  All channels share the same period interrupt type setting.

Definition at line 778 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] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination of enabled channels. Each bit corresponds to a channel. Bit 0 is channel 0, bit 1 is channel 1...

Returns
  None

Definition at line 393 of file pwm.c.

## ◆ PWM_GetADCTriggerFlag()

uint32_t PWM_GetADCTriggerFlag | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelNum
| ) |  |

This function get selected channel trigger ADC flag.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  Combination of following trigger conditions which triggered ADC
  - PWM_TRIGGER_ADC_PERIOD_POINT
  - PWM_TRIGGER_ADC_CENTER_POINT
  - PWM_TRIGGER_ADC_FALLING_EDGE_POINT
  - PWM_TRIGGER_ADC_FALLING_EDGE_POINT

Definition at line 457 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  Capture interrupt flag of specified channel

Return values

  0 | Capture interrupt did not occurred
  PWM_RISING_LATCH_INT_FLAG | Rising edge latch interrupt occurred
  PWM_FALLING_LATCH_INT_FLAG | Falling edge latch interrupt occurred
  PWM_RISING_FALLING_LATCH_INT_FLAG | Rising and falling edge latch interrupt occurred

Definition at line 660 of file pwm.c.

## ◆ PWM_GetDutyIntFlag()

uint32_t PWM_GetDutyIntFlag | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelNum
| ) |  |

This function get duty interrupt flag of selected channel.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  Duty interrupt flag of specified channel

Return values

  0 | Duty interrupt did not occurred
  1 | Duty interrupt occurred

Definition at line 713 of file pwm.c.

## ◆ PWM_GetFaultBrakeIntFlag()

uint32_t PWM_GetFaultBrakeIntFlag | ( | PWM_T * | pwm,
|  | uint32_t | u32BrakeSource
| ) |  |

This function get fault brake interrupt of selected source.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32BrakeSource | Fault brake source, could be either PWM_INTSTS_BRKIF0_Msk, or PWM_INTSTS_BRKIF1_Msk

Returns
  Fault brake interrupt flag of specified source

Return values

  0 | Fault brake interrupt did not occurred
  1 | Fault brake interrupt occurred

Definition at line 763 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] | pwm | The base address of PWM module
  [in] | u32ChannelNum | PWM channel number. Valid values are between 0~5

Returns
  Period interrupt flag of specified channel

Return values

  0 | Period interrupt did not occurred
  1 | Period interrupt occurred

Definition at line 817 of file pwm.c.

## ◆ PWM_Start()

void PWM_Start | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelMask
| ) |  |

This function start PWM module.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination of enabled channels. Each bit corresponds to a channel. Bit 0 is channel 0, bit 1 is channel 1...

Returns
  None

Definition at line 361 of file pwm.c.

## ◆ PWM_Stop()

void PWM_Stop | ( | PWM_T * | pwm,
|  | uint32_t | u32ChannelMask
| ) |  |

This function stop PWM module.

Parameters

  [in] | pwm | The base address of PWM module
  [in] | u32ChannelMask | Combination of enabled channels. Each bit corresponds to a channel. Bit 0 is channel 0, bit 1 is channel 1...

Returns
  None

Definition at line 373 of file pwm.c.