FlexTimer Module Counter Peripheral Driver.
The FTM of the S32K1xx is based on a 16 bits counter and supports: input capture, output compare, PWM and some instances include quadrature decoder.
For all operation modes (without Quadrature Decoder mode) the user need to configure ftm_user_config_t. This structure will be used for initialization (FTM_DRV_Init). The next functions used are specific for each operation mode.
For this mode the user needs to configure parameters like: counter mode (up-counting or up-down counting), maximum counter value, initial counter value. All this information is included in the ftm_timer_param_t structure.
Example:
Data Structures | |
struct | ftm_timer_param_t |
FlexTimer driver timer mode configuration structure. More... | |
Functions | |
status_t | FTM_DRV_InitCounter (uint32_t instance, const ftm_timer_param_t *timer) |
Initialize the FTM counter. More... | |
status_t | FTM_DRV_CounterStart (uint32_t instance) |
Starts the FTM counter. More... | |
status_t | FTM_DRV_CounterStop (uint32_t instance) |
Stops the FTM counter. More... | |
uint32_t | FTM_DRV_CounterRead (uint32_t instance) |
Reads back the current value of the FTM counter. More... | |
uint32_t FTM_DRV_CounterRead | ( | uint32_t | instance | ) |
Reads back the current value of the FTM counter.
[in] | instance | The FTM peripheral instance number. |
Definition at line 153 of file ftm_mc_driver.c.
status_t FTM_DRV_CounterStart | ( | uint32_t | instance | ) |
Starts the FTM counter.
[in] | instance | The FTM peripheral instance number. |
Definition at line 112 of file ftm_mc_driver.c.
status_t FTM_DRV_CounterStop | ( | uint32_t | instance | ) |
Stops the FTM counter.
[in] | instance | The FTM peripheral instance number. |
Definition at line 133 of file ftm_mc_driver.c.
status_t FTM_DRV_InitCounter | ( | uint32_t | instance, |
const ftm_timer_param_t * | timer | ||
) |
Initialize the FTM counter.
Starts the FTM counter. This function provides access to the FTM counter settings. The counter can be run in Up counting and Up-down counting modes. To run the counter in Free running mode, choose Up counting option and provide 0x0 for the countStartVal and 0xFFFF for countFinalVal. Please call this function only when FTM is used as timer/counter.
[in] | instance | The FTM peripheral instance number. |
[in] | timer | Timer configuration structure. |
Definition at line 53 of file ftm_mc_driver.c.