S32 SDK
FTM Output Compare Driver

Detailed Description

FlexTimer Peripheral Output Compare Driver.

Data Structures

struct  ftm_output_cmp_ch_param_t
 FlexTimer driver PWM parameters. More...
 
struct  ftm_output_cmp_param_t
 FlexTimer driver PWM parameters. More...
 

Enumerations

enum  ftm_output_compare_mode_t { FTM_DISABLE_OUTPUT = 0x00U, FTM_TOGGLE_ON_MATCH = 0x01U, FTM_CLEAR_ON_MATCH = 0x02U, FTM_SET_ON_MATCH = 0x03U }
 FlexTimer Mode configuration for output compare mode. More...
 
enum  ftm_output_compare_update_t { FTM_RELATIVE_VALUE = 0x00U, FTM_ABSOLUTE_VALUE = 0x01U }
 FlexTimer input capture type of the next output compare value. More...
 

Functions

status_t FTM_DRV_InitOutputCompare (uint32_t instance, const ftm_output_cmp_param_t *param)
 Configures the FTM to generate timed pulses(Output compare mode). More...
 
status_t FTM_DRV_DeinitOutputCompare (uint32_t instance, const ftm_output_cmp_param_t *param)
 Disables compare match output control and clears FTM timer configuration. More...
 
status_t FTM_DRV_UpdateOutputCompareChannel (uint32_t instance, uint8_t channel, uint16_t nextComparematchValue, ftm_output_compare_update_t update, bool softwareTrigger)
 Sets the next compare match value based on the current counter value. More...
 

Enumeration Type Documentation

FlexTimer Mode configuration for output compare mode.

Implements : ftm_output_compare_mode_t_Class

Enumerator
FTM_DISABLE_OUTPUT 

No action on output pin

FTM_TOGGLE_ON_MATCH 

Toggle on match

FTM_CLEAR_ON_MATCH 

Clear on match

FTM_SET_ON_MATCH 

Set on match

Definition at line 47 of file ftm_oc_driver.h.

FlexTimer input capture type of the next output compare value.

Implements : ftm_output_compare_update_t_Class

Enumerator
FTM_RELATIVE_VALUE 

Next compared value is relative to current value

FTM_ABSOLUTE_VALUE 

Next compared value is absolute

Definition at line 60 of file ftm_oc_driver.h.

Function Documentation

status_t FTM_DRV_DeinitOutputCompare ( uint32_t  instance,
const ftm_output_cmp_param_t param 
)

Disables compare match output control and clears FTM timer configuration.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]paramConfiguration of the output compare channel
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 108 of file ftm_oc_driver.c.

status_t FTM_DRV_InitOutputCompare ( uint32_t  instance,
const ftm_output_cmp_param_t param 
)

Configures the FTM to generate timed pulses(Output compare mode).

When the FTM counter matches the value of CnV, the channel output is changed based on what is specified in the compareMode argument. The signal period can be modified using param->MaxCountValue. After this function max counter value and CnV are equal. FTM_DRV_SetNextComparematchValue function can be used to change CnV value.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]paramconfiguration of the output compare channels
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 45 of file ftm_oc_driver.c.

status_t FTM_DRV_UpdateOutputCompareChannel ( uint32_t  instance,
uint8_t  channel,
uint16_t  nextComparematchValue,
ftm_output_compare_update_t  update,
bool  softwareTrigger 
)

Sets the next compare match value based on the current counter value.

Parameters
[in]instanceThe FTM peripheral instance number.
[in]channelConfiguration of the output compare channel
[in]nextComparematchValueTimer value in ticks until the next compare match event should appear
[in]update
  • FTM_RELATIVE_VALUE : nextComparemantchValue will be added to current counter value
  • FTM_ABSOLUTE_VALUE : nextComparemantchValue will be written in counter register as it is
[in]softwareTriggerThis parameter will be true if software trigger sync is enabled and the user want to generate a software trigger (the value from buffer will be moved to register immediate or at next loading point depending on the sync configuration). Otherwise this parameter must be false and the next compared value will be stored in buffer until a trigger signal will be received.
Returns
success
  • STATUS_SUCCESS : Completed successfully.
  • STATUS_ERROR : Error occurred.

Definition at line 150 of file ftm_oc_driver.c.