RTEMS 6.1-rc6
|
Data Structures | |
struct | _pwm_signal_param |
Structure for the user to define the PWM signal characteristics. More... | |
struct | _pwm_config |
PWM config structure. More... | |
struct | _pwm_fault_input_filter_param |
Structure for the user to configure the fault input filter. More... | |
struct | _pwm_fault_param |
Structure is used to hold the parameters to configure a PWM fault. More... | |
struct | _pwm_input_capture_param |
Structure is used to hold parameters to configure the capture capability of a signal pin. More... | |
Functions | |
void | PWM_SetupInputCapture (PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, const pwm_input_capture_param_t *inputCaptureParams) |
Sets up the PWM input capture. | |
void | PWM_SetupFaultInputFilter (PWM_Type *base, const pwm_fault_input_filter_param_t *faultInputFilterParams) |
Sets up the PWM fault input filter. | |
void | PWM_SetupFaults (PWM_Type *base, pwm_fault_input_t faultNum, const pwm_fault_param_t *faultParams) |
Sets up the PWM fault protection. | |
void | PWM_FaultDefaultConfig (pwm_fault_param_t *config) |
Fill in the PWM fault config struct with the default settings. | |
void | PWM_SetupForceSignal (PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, pwm_force_signal_t mode) |
Selects the signal to output on a PWM pin when a FORCE_OUT signal is asserted. | |
uint8_t | PWM_GetPwmChannelState (PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel) |
Get the dutycycle value. | |
status_t | PWM_SetOutputToIdle (PWM_Type *base, pwm_channels_t pwmChannel, pwm_submodule_t subModule, bool idleStatus) |
Set PWM output in idle status (high or low). | |
void | PWM_SetClockMode (PWM_Type *base, pwm_submodule_t subModule, pwm_clock_prescale_t prescaler) |
Set the pwm submodule prescaler. | |
void | PWM_SetPwmForceOutputToZero (PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, bool forcetozero) |
This function enables-disables the forcing of the output of a given eFlexPwm channel to logic 0. | |
void | PWM_SetChannelOutput (PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, pwm_output_state_t outputstate) |
This function set the output state of the PWM pin as requested for the current cycle. | |
Driver version | |
enum | _pwm_submodule { kPWM_Module_0 = 0U , kPWM_Module_1 , kPWM_Module_2 , kPWM_Module_3 } |
List of PWM submodules. More... | |
enum | _pwm_channels { kPWM_PwmB = 0U , kPWM_PwmA , kPWM_PwmX } |
List of PWM channels in each module. | |
enum | _pwm_value_register { kPWM_ValueRegister_0 = 0U , kPWM_ValueRegister_1 , kPWM_ValueRegister_2 , kPWM_ValueRegister_3 , kPWM_ValueRegister_4 , kPWM_ValueRegister_5 } |
List of PWM value registers. More... | |
enum | _pwm_value_register_mask { kPWM_ValueRegisterMask_0 = (1U << 0) , kPWM_ValueRegisterMask_1 = (1U << 1) , kPWM_ValueRegisterMask_2 = (1U << 2) , kPWM_ValueRegisterMask_3 = (1U << 3) , kPWM_ValueRegisterMask_4 = (1U << 4) , kPWM_ValueRegisterMask_5 = (1U << 5) } |
List of PWM value registers mask. More... | |
enum | _pwm_clock_source { kPWM_BusClock = 0U , kPWM_ExternalClock , kPWM_Submodule0Clock } |
PWM clock source selection. More... | |
enum | _pwm_clock_prescale { kPWM_Prescale_Divide_1 = 0U , kPWM_Prescale_Divide_2 , kPWM_Prescale_Divide_4 , kPWM_Prescale_Divide_8 , kPWM_Prescale_Divide_16 , kPWM_Prescale_Divide_32 , kPWM_Prescale_Divide_64 , kPWM_Prescale_Divide_128 } |
PWM prescaler factor selection for clock source. More... | |
enum | _pwm_force_output_trigger { kPWM_Force_Local = 0U , kPWM_Force_Master , kPWM_Force_LocalReload , kPWM_Force_MasterReload , kPWM_Force_LocalSync , kPWM_Force_MasterSync , kPWM_Force_External , kPWM_Force_ExternalSync } |
Options that can trigger a PWM FORCE_OUT. More... | |
enum | _pwm_output_state { kPWM_HighState = 0 , kPWM_LowState , kPWM_NormalState , kPWM_InvertState , kPWM_MaskState } |
PWM channel output status. More... | |
enum | _pwm_init_source { kPWM_Initialize_LocalSync = 0U , kPWM_Initialize_MasterReload , kPWM_Initialize_MasterSync , kPWM_Initialize_ExtSync } |
PWM counter initialization options. More... | |
enum | _pwm_load_frequency { kPWM_LoadEveryOportunity = 0U , kPWM_LoadEvery2Oportunity , kPWM_LoadEvery3Oportunity , kPWM_LoadEvery4Oportunity , kPWM_LoadEvery5Oportunity , kPWM_LoadEvery6Oportunity , kPWM_LoadEvery7Oportunity , kPWM_LoadEvery8Oportunity , kPWM_LoadEvery9Oportunity , kPWM_LoadEvery10Oportunity , kPWM_LoadEvery11Oportunity , kPWM_LoadEvery12Oportunity , kPWM_LoadEvery13Oportunity , kPWM_LoadEvery14Oportunity , kPWM_LoadEvery15Oportunity , kPWM_LoadEvery16Oportunity } |
PWM load frequency selection. More... | |
enum | _pwm_fault_input { kPWM_Fault_0 = 0U , kPWM_Fault_1 , kPWM_Fault_2 , kPWM_Fault_3 } |
List of PWM fault selections. More... | |
enum | _pwm_fault_disable { kPWM_FaultDisable_0 = (1U << 0) , kPWM_FaultDisable_1 = (1U << 1) , kPWM_FaultDisable_2 = (1U << 2) , kPWM_FaultDisable_3 = (1U << 3) } |
List of PWM fault disable mapping selections. More... | |
enum | _pwm_fault_channels { kPWM_faultchannel_0 = 0U , kPWM_faultchannel_1 } |
List of PWM fault channels. | |
enum | _pwm_input_capture_edge { kPWM_Disable = 0U , kPWM_FallingEdge , kPWM_RisingEdge , kPWM_RiseAndFallEdge } |
PWM capture edge select. More... | |
enum | _pwm_force_signal { kPWM_UsePwm = 0U , kPWM_InvertedPwm , kPWM_SoftwareControl , kPWM_UseExternal } |
PWM output options when a FORCE_OUT signal is asserted. More... | |
enum | _pwm_chnl_pair_operation { kPWM_Independent = 0U , kPWM_ComplementaryPwmA , kPWM_ComplementaryPwmB } |
Options available for the PWM A & B pair operation. More... | |
enum | _pwm_register_reload { kPWM_ReloadImmediate = 0U , kPWM_ReloadPwmHalfCycle , kPWM_ReloadPwmFullCycle , kPWM_ReloadPwmHalfAndFullCycle } |
Options available on how to load the buffered-registers with new values. More... | |
enum | _pwm_fault_recovery_mode { kPWM_NoRecovery = 0U , kPWM_RecoverHalfCycle , kPWM_RecoverFullCycle , kPWM_RecoverHalfAndFullCycle } |
Options available on how to re-enable the PWM output when recovering from a fault. More... | |
enum | _pwm_interrupt_enable { kPWM_CompareVal0InterruptEnable = (1U << 0) , kPWM_CompareVal1InterruptEnable = (1U << 1) , kPWM_CompareVal2InterruptEnable = (1U << 2) , kPWM_CompareVal3InterruptEnable = (1U << 3) , kPWM_CompareVal4InterruptEnable = (1U << 4) , kPWM_CompareVal5InterruptEnable = (1U << 5) , kPWM_CaptureX0InterruptEnable = (1U << 6) , kPWM_CaptureX1InterruptEnable = (1U << 7) , kPWM_CaptureB0InterruptEnable = (1U << 8) , kPWM_CaptureB1InterruptEnable = (1U << 9) , kPWM_CaptureA0InterruptEnable = (1U << 10) , kPWM_CaptureA1InterruptEnable = (1U << 11) , kPWM_ReloadInterruptEnable = (1U << 12) , kPWM_ReloadErrorInterruptEnable = (1U << 13) , kPWM_Fault0InterruptEnable = (1U << 16) , kPWM_Fault1InterruptEnable = (1U << 17) , kPWM_Fault2InterruptEnable = (1U << 18) , kPWM_Fault3InterruptEnable = (1U << 19) } |
List of PWM interrupt options. More... | |
enum | _pwm_status_flags { kPWM_CompareVal0Flag = (1U << 0) , kPWM_CompareVal1Flag = (1U << 1) , kPWM_CompareVal2Flag = (1U << 2) , kPWM_CompareVal3Flag = (1U << 3) , kPWM_CompareVal4Flag = (1U << 4) , kPWM_CompareVal5Flag = (1U << 5) , kPWM_CaptureX0Flag = (1U << 6) , kPWM_CaptureX1Flag = (1U << 7) , kPWM_CaptureB0Flag = (1U << 8) , kPWM_CaptureB1Flag = (1U << 9) , kPWM_CaptureA0Flag = (1U << 10) , kPWM_CaptureA1Flag = (1U << 11) , kPWM_ReloadFlag = (1U << 12) , kPWM_ReloadErrorFlag = (1U << 13) , kPWM_RegUpdatedFlag = (1U << 14) , kPWM_Fault0Flag = (1U << 16) , kPWM_Fault1Flag = (1U << 17) , kPWM_Fault2Flag = (1U << 18) , kPWM_Fault3Flag = (1U << 19) } |
List of PWM status flags. More... | |
enum | _pwm_dma_enable { kPWM_CaptureX0DMAEnable = (1U << 0) , kPWM_CaptureX1DMAEnable = (1U << 1) , kPWM_CaptureB0DMAEnable = (1U << 2) , kPWM_CaptureB1DMAEnable = (1U << 3) , kPWM_CaptureA0DMAEnable = (1U << 4) , kPWM_CaptureA1DMAEnable = (1U << 5) } |
List of PWM DMA options. More... | |
enum | _pwm_dma_source_select { kPWM_DMARequestDisable = 0U , kPWM_DMAWatermarksEnable , kPWM_DMALocalSync , kPWM_DMALocalReload } |
List of PWM capture DMA enable source select. More... | |
enum | _pwm_watermark_control { kPWM_FIFOWatermarksOR = 0U , kPWM_FIFOWatermarksAND } |
PWM FIFO Watermark AND Control. More... | |
enum | _pwm_mode { kPWM_SignedCenterAligned = 0U , kPWM_CenterAligned , kPWM_SignedEdgeAligned , kPWM_EdgeAligned } |
PWM operation mode. More... | |
enum | _pwm_level_select { kPWM_HighTrue = 0U , kPWM_LowTrue } |
PWM output pulse mode, high-true or low-true. More... | |
enum | _pwm_fault_state { kPWM_PwmFaultState0 , kPWM_PwmFaultState1 , kPWM_PwmFaultState2 , kPWM_PwmFaultState3 } |
PWM output fault status. More... | |
enum | _pwm_reload_source_select { kPWM_LocalReload = 0U , kPWM_MasterReload } |
PWM reload source select. More... | |
enum | _pwm_fault_clear { kPWM_Automatic = 0U , kPWM_ManualNormal , kPWM_ManualSafety } |
PWM fault clearing options. More... | |
enum | _pwm_module_control { kPWM_Control_Module_0 = (1U << 0) , kPWM_Control_Module_1 = (1U << 1) , kPWM_Control_Module_2 = (1U << 2) , kPWM_Control_Module_3 = (1U << 3) } |
Options for submodule master control operation. More... | |
typedef enum _pwm_submodule | pwm_submodule_t |
List of PWM submodules. | |
typedef enum _pwm_channels | pwm_channels_t |
List of PWM channels in each module. | |
typedef enum _pwm_value_register | pwm_value_register_t |
List of PWM value registers. | |
typedef enum _pwm_clock_source | pwm_clock_source_t |
PWM clock source selection. | |
typedef enum _pwm_clock_prescale | pwm_clock_prescale_t |
PWM prescaler factor selection for clock source. | |
typedef enum _pwm_force_output_trigger | pwm_force_output_trigger_t |
Options that can trigger a PWM FORCE_OUT. | |
typedef enum _pwm_output_state | pwm_output_state_t |
PWM channel output status. | |
typedef enum _pwm_init_source | pwm_init_source_t |
PWM counter initialization options. | |
typedef enum _pwm_load_frequency | pwm_load_frequency_t |
PWM load frequency selection. | |
typedef enum _pwm_fault_input | pwm_fault_input_t |
List of PWM fault selections. | |
typedef enum _pwm_fault_disable | pwm_fault_disable_t |
List of PWM fault disable mapping selections. | |
typedef enum _pwm_fault_channels | pwm_fault_channels_t |
List of PWM fault channels. | |
typedef enum _pwm_input_capture_edge | pwm_input_capture_edge_t |
PWM capture edge select. | |
typedef enum _pwm_force_signal | pwm_force_signal_t |
PWM output options when a FORCE_OUT signal is asserted. | |
typedef enum _pwm_chnl_pair_operation | pwm_chnl_pair_operation_t |
Options available for the PWM A & B pair operation. | |
typedef enum _pwm_register_reload | pwm_register_reload_t |
Options available on how to load the buffered-registers with new values. | |
typedef enum _pwm_fault_recovery_mode | pwm_fault_recovery_mode_t |
Options available on how to re-enable the PWM output when recovering from a fault. | |
typedef enum _pwm_interrupt_enable | pwm_interrupt_enable_t |
List of PWM interrupt options. | |
typedef enum _pwm_status_flags | pwm_status_flags_t |
List of PWM status flags. | |
typedef enum _pwm_dma_enable | pwm_dma_enable_t |
List of PWM DMA options. | |
typedef enum _pwm_dma_source_select | pwm_dma_source_select_t |
List of PWM capture DMA enable source select. | |
typedef enum _pwm_watermark_control | pwm_watermark_control_t |
PWM FIFO Watermark AND Control. | |
typedef enum _pwm_mode | pwm_mode_t |
PWM operation mode. | |
typedef enum _pwm_level_select | pwm_level_select_t |
PWM output pulse mode, high-true or low-true. | |
typedef enum _pwm_fault_state | pwm_fault_state_t |
PWM output fault status. | |
typedef enum _pwm_reload_source_select | pwm_reload_source_select_t |
PWM reload source select. | |
typedef enum _pwm_fault_clear | pwm_fault_clear_t |
PWM fault clearing options. | |
typedef enum _pwm_module_control | pwm_module_control_t |
Options for submodule master control operation. | |
typedef struct _pwm_signal_param | pwm_signal_param_t |
Structure for the user to define the PWM signal characteristics. | |
typedef struct _pwm_config | pwm_config_t |
PWM config structure. | |
typedef struct _pwm_fault_input_filter_param | pwm_fault_input_filter_param_t |
Structure for the user to configure the fault input filter. | |
typedef struct _pwm_fault_param | pwm_fault_param_t |
Structure is used to hold the parameters to configure a PWM fault. | |
typedef struct _pwm_input_capture_param | pwm_input_capture_param_t |
Structure is used to hold parameters to configure the capture capability of a signal pin. | |
#define | FSL_PWM_DRIVER_VERSION (MAKE_VERSION(2, 5, 1)) |
#define | PWM_SUBMODULE_SWCONTROL_WIDTH 2 |
#define | PWM_SUBMODULE_CHANNEL 2 |
Initialization and deinitialization | |
status_t | PWM_Init (PWM_Type *base, pwm_submodule_t subModule, const pwm_config_t *config) |
Ungates the PWM submodule clock and configures the peripheral for basic operation. | |
void | PWM_Deinit (PWM_Type *base, pwm_submodule_t subModule) |
Gate the PWM submodule clock. | |
void | PWM_GetDefaultConfig (pwm_config_t *config) |
Fill in the PWM config struct with the default settings. | |
Module PWM output | |
status_t | PWM_SetupPwm (PWM_Type *base, pwm_submodule_t subModule, const pwm_signal_param_t *chnlParams, uint8_t numOfChnls, pwm_mode_t mode, uint32_t pwmFreq_Hz, uint32_t srcClock_Hz) |
Sets up the PWM signals for a PWM submodule. | |
status_t | PWM_SetupPwmPhaseShift (PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, uint32_t pwmFreq_Hz, uint32_t srcClock_Hz, uint8_t shiftvalue, bool doSync) |
Set PWM phase shift for PWM channel running on channel PWM_A, PWM_B which with 50% duty cycle.. | |
void | PWM_UpdatePwmDutycycle (PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmSignal, pwm_mode_t currPwmMode, uint8_t dutyCyclePercent) |
Updates the PWM signal's dutycycle. | |
void | PWM_UpdatePwmDutycycleHighAccuracy (PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmSignal, pwm_mode_t currPwmMode, uint16_t dutyCycle) |
Updates the PWM signal's dutycycle with 16-bit accuracy. | |
Interrupts Interface | |
void | PWM_EnableInterrupts (PWM_Type *base, pwm_submodule_t subModule, uint32_t mask) |
Enables the selected PWM interrupts. | |
void | PWM_DisableInterrupts (PWM_Type *base, pwm_submodule_t subModule, uint32_t mask) |
Disables the selected PWM interrupts. | |
uint32_t | PWM_GetEnabledInterrupts (PWM_Type *base, pwm_submodule_t subModule) |
Gets the enabled PWM interrupts. | |
Status Interface | |
uint32_t | PWM_GetStatusFlags (PWM_Type *base, pwm_submodule_t subModule) |
Gets the PWM status flags. | |
void | PWM_ClearStatusFlags (PWM_Type *base, pwm_submodule_t subModule, uint32_t mask) |
Clears the PWM status flags. | |
#define FSL_PWM_DRIVER_VERSION (MAKE_VERSION(2, 5, 1)) |
Version 2.5.1
#define PWM_SUBMODULE_CHANNEL 2 |
Because setting the pwm duty cycle doesn't support PWMX, getting the pwm duty cycle also doesn't support PWMX.
#define PWM_SUBMODULE_SWCONTROL_WIDTH 2 |
Number of bits per submodule for software output control
typedef struct _pwm_config pwm_config_t |
PWM config structure.
This structure holds the configuration settings for the PWM peripheral. To initialize this structure to reasonable defaults, call the PWM_GetDefaultConfig() function and pass a pointer to your config structure instance.
The config struct can be made const so it resides in flash
Options available for the PWM A & B pair operation.
enum _pwm_clock_prescale |
PWM prescaler factor selection for clock source.
enum _pwm_clock_source |
enum _pwm_dma_enable |
List of PWM capture DMA enable source select.
enum _pwm_fault_clear |
enum _pwm_fault_disable |
enum _pwm_fault_input |
Options available on how to re-enable the PWM output when recovering from a fault.
enum _pwm_fault_state |
PWM output fault status.
Options that can trigger a PWM FORCE_OUT.
enum _pwm_force_signal |
PWM output options when a FORCE_OUT signal is asserted.
enum _pwm_init_source |
PWM counter initialization options.
List of PWM interrupt options.
enum _pwm_level_select |
enum _pwm_load_frequency |
PWM load frequency selection.
enum _pwm_mode |
enum _pwm_module_control |
Options for submodule master control operation.
enum _pwm_output_state |
PWM channel output status.
enum _pwm_register_reload |
Options available on how to load the buffered-registers with new values.
enum _pwm_status_flags |
List of PWM status flags.
enum _pwm_submodule |
enum _pwm_value_register |
List of PWM value registers mask.
void PWM_ClearStatusFlags | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
uint32_t | mask | ||
) |
Clears the PWM status flags.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
mask | The status flags to clear. This is a logical OR of members of the enumeration pwm_status_flags_t |
brief Clears the PWM status flags
param base PWM peripheral base address param subModule PWM submodule to configure param mask The status flags to clear. This is a logical OR of members of the enumeration pwm_status_flags_t
void PWM_Deinit | ( | PWM_Type * | base, |
pwm_submodule_t | subModule | ||
) |
Gate the PWM submodule clock.
base | PWM peripheral base address |
subModule | PWM submodule to deinitialize |
brief Gate the PWM submodule clock
param base PWM peripheral base address param subModule PWM submodule to deinitialize
void PWM_DisableInterrupts | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
uint32_t | mask | ||
) |
Disables the selected PWM interrupts.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
mask | The interrupts to enable. This is a logical OR of members of the enumeration pwm_interrupt_enable_t |
brief Disables the selected PWM interrupts
param base PWM peripheral base address param subModule PWM submodule to configure param mask The interrupts to enable. This is a logical OR of members of the enumeration pwm_interrupt_enable_t
void PWM_EnableInterrupts | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
uint32_t | mask | ||
) |
Enables the selected PWM interrupts.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
mask | The interrupts to enable. This is a logical OR of members of the enumeration pwm_interrupt_enable_t |
brief Enables the selected PWM interrupts
param base PWM peripheral base address param subModule PWM submodule to configure param mask The interrupts to enable. This is a logical OR of members of the enumeration pwm_interrupt_enable_t
void PWM_FaultDefaultConfig | ( | pwm_fault_param_t * | config | ) |
Fill in the PWM fault config struct with the default settings.
The default values are:
config | Pointer to user's PWM fault config structure. |
brief Fill in the PWM fault config struct with the default settings
The default values are: code config->faultClearingMode = kPWM_Automatic; config->faultLevel = false; config->enableCombinationalPath = true; config->recoverMode = kPWM_NoRecovery; endcode param config Pointer to user's PWM fault config structure.
void PWM_GetDefaultConfig | ( | pwm_config_t * | config | ) |
Fill in the PWM config struct with the default settings.
The default values are:
config | Pointer to user's PWM config structure. |
brief Fill in the PWM config struct with the default settings
The default values are: code config->enableDebugMode = false; config->enableWait = false; config->reloadSelect = kPWM_LocalReload; config->clockSource = kPWM_BusClock; config->prescale = kPWM_Prescale_Divide_1; config->initializationControl = kPWM_Initialize_LocalSync; config->forceTrigger = kPWM_Force_Local; config->reloadFrequency = kPWM_LoadEveryOportunity; config->reloadLogic = kPWM_ReloadImmediate; config->pairOperation = kPWM_Independent; endcode param config Pointer to user's PWM config structure.
uint32_t PWM_GetEnabledInterrupts | ( | PWM_Type * | base, |
pwm_submodule_t | subModule | ||
) |
Gets the enabled PWM interrupts.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
brief Gets the enabled PWM interrupts
param base PWM peripheral base address param subModule PWM submodule to configure
return The enabled interrupts. This is the logical OR of members of the enumeration pwm_interrupt_enable_t
uint8_t PWM_GetPwmChannelState | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
pwm_channels_t | pwmChannel | ||
) |
Get the dutycycle value.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
pwmChannel | PWM channel to configure |
brief Get the dutycycle value.
param base PWM peripheral base address param subModule PWM submodule to configure param pwmChannel PWM channel to configure
return Current channel dutycycle value.
uint32_t PWM_GetStatusFlags | ( | PWM_Type * | base, |
pwm_submodule_t | subModule | ||
) |
Gets the PWM status flags.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
brief Gets the PWM status flags
param base PWM peripheral base address param subModule PWM submodule to configure
return The status flags. This is the logical OR of members of the enumeration pwm_status_flags_t
status_t PWM_Init | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
const pwm_config_t * | config | ||
) |
Ungates the PWM submodule clock and configures the peripheral for basic operation.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
config | Pointer to user's PWM config structure. |
brief Ungates the PWM submodule clock and configures the peripheral for basic operation.
note This API should be called at the beginning of the application using the PWM driver.
param base PWM peripheral base address param subModule PWM submodule to configure param config Pointer to user's PWM config structure.
return kStatus_Success means success; else failed.
void PWM_SetChannelOutput | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
pwm_channels_t | pwmChannel, | ||
pwm_output_state_t | outputstate | ||
) |
This function set the output state of the PWM pin as requested for the current cycle.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
pwmChannel | PWM channel to configure |
outputstate | Set pwm output state, see pwm_output_state_t. |
brief This function set the output state of the PWM pin as requested for the current cycle.
param base PWM peripheral base address param subModule PWM submodule to configure param pwmChannel PWM channel to configure param outputstate Set pwm output state, see pwm_output_state_t.
void PWM_SetClockMode | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
pwm_clock_prescale_t | prescaler | ||
) |
Set the pwm submodule prescaler.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
prescaler | Set prescaler value |
brief Set the pwm submodule prescaler.
param base PWM peripheral base address param subModule PWM submodule to configure param prescaler Set prescaler value
status_t PWM_SetOutputToIdle | ( | PWM_Type * | base, |
pwm_channels_t | pwmChannel, | ||
pwm_submodule_t | subModule, | ||
bool | idleStatus | ||
) |
Set PWM output in idle status (high or low).
base | PWM peripheral base address |
pwmChannel | PWM channel to configure |
subModule | PWM submodule to configure |
idleStatus | True: PWM output is high in idle status; false: PWM output is low in idle status. |
brief Set PWM output in idle status (high or low).
note This API should call after PWM_SetupPwm() APIs, and PWMX submodule is not supported.
param base PWM peripheral base address param pwmChannel PWM channel to configure param subModule PWM submodule to configure param idleStatus True: PWM output is high in idle status; false: PWM output is low in idle status.
return kStatus_Fail if there was error setting up the signal; kStatus_Success if set output idle success
void PWM_SetPwmForceOutputToZero | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
pwm_channels_t | pwmChannel, | ||
bool | forcetozero | ||
) |
This function enables-disables the forcing of the output of a given eFlexPwm channel to logic 0.
base | PWM peripheral base address |
pwmChannel | PWM channel to configure |
subModule | PWM submodule to configure |
forcetozero | True: Enable the pwm force output to zero; False: Disable the pwm output resumes normal function. |
brief This function enables-disables the forcing of the output of a given eFlexPwm channel to logic 0.
param base PWM peripheral base address param pwmChannel PWM channel to configure param subModule PWM submodule to configure param forcetozero True: Enable the pwm force output to zero; False: Disable the pwm output resumes normal function.
void PWM_SetupFaultInputFilter | ( | PWM_Type * | base, |
const pwm_fault_input_filter_param_t * | faultInputFilterParams | ||
) |
Sets up the PWM fault input filter.
base | PWM peripheral base address |
faultInputFilterParams | Parameters passed in to set up the fault input filter. |
base | PWM peripheral base address |
faultInputFilterParams | Parameters passed in to set up the fault input filter. |
void PWM_SetupFaults | ( | PWM_Type * | base, |
pwm_fault_input_t | faultNum, | ||
const pwm_fault_param_t * | faultParams | ||
) |
Sets up the PWM fault protection.
PWM has 4 fault inputs.
base | PWM peripheral base address |
faultNum | PWM fault to configure. |
faultParams | Pointer to the PWM fault config structure |
brief Sets up the PWM fault protection.
PWM has 4 fault inputs.
param base PWM peripheral base address param faultNum PWM fault to configure. param faultParams Pointer to the PWM fault config structure
void PWM_SetupForceSignal | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
pwm_channels_t | pwmChannel, | ||
pwm_force_signal_t | mode | ||
) |
Selects the signal to output on a PWM pin when a FORCE_OUT signal is asserted.
The user specifies which channel to configure by supplying the submodule number and whether to modify PWM A or PWM B within that submodule.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
pwmChannel | Channel to configure |
mode | Signal to output when a FORCE_OUT is triggered |
brief Selects the signal to output on a PWM pin when a FORCE_OUT signal is asserted.
The user specifies which channel to configure by supplying the submodule number and whether to modify PWM A or PWM B within that submodule.
param base PWM peripheral base address param subModule PWM submodule to configure param pwmChannel Channel to configure param mode Signal to output when a FORCE_OUT is triggered
void PWM_SetupInputCapture | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
pwm_channels_t | pwmChannel, | ||
const pwm_input_capture_param_t * | inputCaptureParams | ||
) |
Sets up the PWM input capture.
Each PWM submodule has 3 pins that can be configured for use as input capture pins. This function sets up the capture parameters for each pin and enables the pin for input capture operation.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
pwmChannel | Channel in the submodule to setup |
inputCaptureParams | Parameters passed in to set up the input pin |
brief Sets up the PWM input capture
Each PWM submodule has 3 pins that can be configured for use as input capture pins. This function sets up the capture parameters for each pin and enables the pin for input capture operation.
param base PWM peripheral base address param subModule PWM submodule to configure param pwmChannel Channel in the submodule to setup param inputCaptureParams Parameters passed in to set up the input pin
status_t PWM_SetupPwm | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
const pwm_signal_param_t * | chnlParams, | ||
uint8_t | numOfChnls, | ||
pwm_mode_t | mode, | ||
uint32_t | pwmFreq_Hz, | ||
uint32_t | srcClock_Hz | ||
) |
Sets up the PWM signals for a PWM submodule.
The function initializes the submodule according to the parameters passed in by the user. The function also sets up the value compare registers to match the PWM signal requirements. If the dead time insertion logic is enabled, the pulse period is reduced by the dead time period specified by the user.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
chnlParams | Array of PWM channel parameters to configure the channel(s), PWMX submodule is not supported. |
numOfChnls | Number of channels to configure, this should be the size of the array passed in. Array size should not be more than 2 as each submodule has 2 pins to output PWM |
mode | PWM operation mode, options available in enumeration pwm_mode_t |
pwmFreq_Hz | PWM signal frequency in Hz |
srcClock_Hz | PWM main counter clock in Hz. |
brief Sets up the PWM signals for a PWM submodule.
The function initializes the submodule according to the parameters passed in by the user. The function also sets up the value compare registers to match the PWM signal requirements. If the dead time insertion logic is enabled, the pulse period is reduced by the dead time period specified by the user.
param base PWM peripheral base address param subModule PWM submodule to configure param chnlParams Array of PWM channel parameters to configure the channel(s), PWMX submodule is not supported. param numOfChnls Number of channels to configure, this should be the size of the array passed in. Array size should not be more than 2 as each submodule has 2 pins to output PWM param mode PWM operation mode, options available in enumeration pwm_mode_t param pwmFreq_Hz PWM signal frequency in Hz param srcClock_Hz PWM main counter clock in Hz.
return Returns kStatusFail if there was error setting up the signal; kStatusSuccess otherwise
status_t PWM_SetupPwmPhaseShift | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
pwm_channels_t | pwmChannel, | ||
uint32_t | pwmFreq_Hz, | ||
uint32_t | srcClock_Hz, | ||
uint8_t | shiftvalue, | ||
bool | doSync | ||
) |
Set PWM phase shift for PWM channel running on channel PWM_A, PWM_B which with 50% duty cycle..
base | PWM peripheral base address |
subModule | PWM submodule to configure |
pwmChannel | PWM channel to configure |
pwmFreq_Hz | PWM signal frequency in Hz |
srcClock_Hz | PWM main counter clock in Hz. |
shiftvalue | Phase shift value |
doSync | true: Set LDOK bit for the submodule list; false: LDOK bit don't set, need to call PWM_SetPwmLdok to sync update. |
brief Set PWM phase shift for PWM channel running on channel PWM_A, PWM_B which with 50% duty cycle.
param base PWM peripheral base address param subModule PWM submodule to configure param pwmChannel PWM channel to configure param pwmFreq_Hz PWM signal frequency in Hz param srcClock_Hz PWM main counter clock in Hz. param shiftvalue Phase shift value, range in 0 ~ 50 param doSync true: Set LDOK bit for the submodule list; false: LDOK bit don't set, need to call PWM_SetPwmLdok to sync update.
return Returns kStatus_Fail if there was error setting up the signal; kStatus_Success otherwise
void PWM_UpdatePwmDutycycle | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
pwm_channels_t | pwmSignal, | ||
pwm_mode_t | currPwmMode, | ||
uint8_t | dutyCyclePercent | ||
) |
Updates the PWM signal's dutycycle.
The function updates the PWM dutycyle to the new value that is passed in. If the dead time insertion logic is enabled then the pulse period is reduced by the dead time period specified by the user.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
pwmSignal | Signal (PWM A or PWM B) to update |
currPwmMode | The current PWM mode set during PWM setup |
dutyCyclePercent | New PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)... 100=active signal (100% duty cycle) |
brief Updates the PWM signal's dutycycle.
The function updates the PWM dutycyle to the new value that is passed in. If the dead time insertion logic is enabled then the pulse period is reduced by the dead time period specified by the user.
param base PWM peripheral base address param subModule PWM submodule to configure param pwmSignal Signal (PWM A or PWM B) to update param currPwmMode The current PWM mode set during PWM setup param dutyCyclePercent New PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)... 100=active signal (100% duty cycle)
void PWM_UpdatePwmDutycycleHighAccuracy | ( | PWM_Type * | base, |
pwm_submodule_t | subModule, | ||
pwm_channels_t | pwmSignal, | ||
pwm_mode_t | currPwmMode, | ||
uint16_t | dutyCycle | ||
) |
Updates the PWM signal's dutycycle with 16-bit accuracy.
The function updates the PWM dutycyle to the new value that is passed in. If the dead time insertion logic is enabled then the pulse period is reduced by the dead time period specified by the user.
base | PWM peripheral base address |
subModule | PWM submodule to configure |
pwmSignal | Signal (PWM A or PWM B) to update |
currPwmMode | The current PWM mode set during PWM setup |
dutyCycle | New PWM pulse width, value should be between 0 to 65535 0=inactive signal(0% duty cycle)... 65535=active signal (100% duty cycle) |
brief Updates the PWM signal's dutycycle with 16-bit accuracy.
The function updates the PWM dutycyle to the new value that is passed in. If the dead time insertion logic is enabled then the pulse period is reduced by the dead time period specified by the user.
param base PWM peripheral base address param subModule PWM submodule to configure param pwmSignal Signal (PWM A or PWM B) to update param currPwmMode The current PWM mode set during PWM setup param dutyCycle New PWM pulse width, value should be between 0 to 65535 0=inactive signal(0% duty cycle)... 65535=active signal (100% duty cycle)