![]()  | 
  
    Kinetis SDK v.1.3 API Reference Manual
    Rev. 0
    
   Freescale Semiconductor, Inc. 
   | 
 
The section describes the programming interface of the TPM HAL driver.
Data Structures | |
| struct | tpm_pwm_param_t | 
| TPM driver PWM parameter.  More... | |
Enumerations | |
| enum | tpm_clock_mode_t | 
| TPM clock source selection for TPM_SC[CMOD].  More... | |
| enum | tpm_counting_mode_t | 
| TPM counting mode, up or down.  | |
| enum | tpm_clock_ps_t | 
| TPM prescaler factor selection for clock source.  | |
| enum | tpm_trigger_source_t {  kTpmTrigSel0 = 0, kTpmTrigSel1, kTpmTrigSel2, kTpmTrigSel3, kTpmTrigSel4, kTpmTrigSel5, kTpmTrigSel6, kTpmTrigSel7, kTpmTrigSel8, kTpmTrigSel9, kTpmTrigSel10, kTpmTrigSel11, kTpmTrigSel12, kTpmTrigSel13, kTpmTrigSel14, kTpmTrigSel15 }  | 
| TPM trigger sources, please refer to the chip reference manual for available options.  More... | |
| enum | tpm_pwm_mode_t {  kTpmEdgeAlignedPWM = 0, kTpmCenterAlignedPWM }  | 
| TPM operation mode.  More... | |
| enum | tpm_pwm_edge_mode_t {  kTpmHighTrue = 0, kTpmLowTrue }  | 
| TPM PWM output pulse mode, high-true or low-true on match up.  More... | |
| enum | tpm_input_capture_mode_t | 
| TPM input capture modes.  | |
| enum | tpm_output_compare_mode_t | 
| TPM output compare modes.  | |
| enum | tpm_status_t {  kStatusTpmSuccess = 0x00U, kStatusTpmFail = 0x01U }  | 
| Error codes for TPM driver.  More... | |
Functions | |
| void | TPM_HAL_Reset (TPM_Type *base, uint32_t instance) | 
| Resets the TPM registers.  More... | |
| void | TPM_HAL_EnablePwmMode (TPM_Type *base, tpm_pwm_param_t *config, uint8_t channel) | 
| Enables the TPM PWM output mode.  More... | |
| void | TPM_HAL_DisableChn (TPM_Type *base, uint8_t channel) | 
| Disables the TPM channel.  More... | |
| void | TPM_HAL_SetClockMode (TPM_Type *base, tpm_clock_mode_t mode) | 
| Sets the TPM clock mode.  More... | |
| static tpm_clock_mode_t | TPM_HAL_GetClockMode (TPM_Type *base) | 
| get TPM clock mode.  More... | |
| static void | TPM_HAL_SetClockDiv (TPM_Type *base, tpm_clock_ps_t ps) | 
| Sets the TPM clock divider.  More... | |
| static tpm_clock_ps_t | TPM_HAL_GetClockDiv (TPM_Type *base) | 
| Gets the TPM clock divider.  More... | |
| static void | TPM_HAL_EnableTimerOverflowInt (TPM_Type *base) | 
| Enables the TPM peripheral timer overflow interrupt.  More... | |
| static void | TPM_HAL_DisableTimerOverflowInt (TPM_Type *base) | 
| Disables the TPM peripheral timer overflow interrupt.  More... | |
| static bool | TPM_HAL_IsOverflowIntEnabled (TPM_Type *base) | 
| Reads the bit that controls TPM timer overflow interrupt enablement.  More... | |
| static bool | TPM_HAL_GetTimerOverflowStatus (TPM_Type *base) | 
| Returns the TPM peripheral timer overflow interrupt flag.  More... | |
| static void | TPM_HAL_ClearTimerOverflowFlag (TPM_Type *base) | 
| Clears the TPM timer overflow interrupt flag.  More... | |
| static void | TPM_HAL_SetCpwms (TPM_Type *base, uint8_t mode) | 
| set TPM center-aligned PWM select.  More... | |
| static bool | TPM_HAL_GetCpwms (TPM_Type *base) | 
| Gets the TPM center-aligned PWM selection value.  More... | |
| static void | TPM_HAL_ClearCounter (TPM_Type *base) | 
| Clears the TPM peripheral current counter value.  More... | |
| static uint16_t | TPM_HAL_GetCounterVal (TPM_Type *base) | 
| Returns the TPM peripheral current counter value.  More... | |
| static void | TPM_HAL_SetMod (TPM_Type *base, uint16_t val) | 
| Sets the TPM peripheral timer modulo value.  More... | |
| static uint16_t | TPM_HAL_GetMod (TPM_Type *base) | 
| Returns the TPM peripheral counter modulo value.  More... | |
| static void | TPM_HAL_SetChnMsnbaElsnbaVal (TPM_Type *base, uint8_t channel, uint8_t value) | 
| Sets the TPM peripheral timer channel mode and edge level,.  More... | |
| static uint8_t | TPM_HAL_GetChnMsnbaVal (TPM_Type *base, uint8_t channel) | 
| Gets the TPM peripheral timer channel mode.  More... | |
| static uint8_t | TPM_HAL_GetChnElsnbaVal (TPM_Type *base, uint8_t channel) | 
| Gets the TPM peripheral timer channel edge level.  More... | |
| static void | TPM_HAL_EnableChnInt (TPM_Type *base, uint8_t channel) | 
| Enables the TPM peripheral timer channel(n) interrupt.  More... | |
| static void | TPM_HAL_DisableChnInt (TPM_Type *base, uint8_t channel) | 
| Disables the TPM peripheral timer channel(n) interrupt.  More... | |
| static bool | TPM_HAL_IsChnIntEnabled (TPM_Type *base, uint8_t channel) | 
| Gets the TPM peripheral timer channel(n) interrupt enabled or not.  More... | |
| static bool | TPM_HAL_GetChnStatus (TPM_Type *base, uint8_t channel) | 
| Returns whether any event for TPM peripheral timer channel has occurred.  More... | |
| static void | TPM_HAL_ClearChnInt (TPM_Type *base, uint8_t channel) | 
| Returns whether any event for the TPM peripheral timer channel has occurred.  More... | |
| static void | TPM_HAL_SetChnCountVal (TPM_Type *base, uint8_t channel, uint16_t val) | 
| Sets the TPM peripheral timer channel counter value.  More... | |
| static uint16_t | TPM_HAL_GetChnCountVal (TPM_Type *base, uint8_t channel) | 
| Gets the TPM peripheral timer channel counter value.  More... | |
| static uint32_t | TPM_HAL_GetStatusRegVal (TPM_Type *base) | 
| Gets the TPM peripheral timer channel event status.  More... | |
| static void | TPM_HAL_ClearStatusReg (TPM_Type *base, uint16_t tpm_status) | 
| Clears the TPM peripheral timer clear status register value,.  More... | |
| static void | TPM_HAL_SetTriggerSrc (TPM_Type *base, tpm_trigger_source_t trigger_num) | 
| Sets the TPM peripheral timer trigger.  More... | |
| static void | TPM_HAL_SetTriggerMode (TPM_Type *base, bool enable) | 
| Sets the TPM peripheral timer running on trigger or not.  More... | |
| static void | TPM_HAL_SetReloadOnTriggerMode (TPM_Type *base, bool enable) | 
| Enables the TPM timer counter reload on selected trigger or not.  More... | |
| static void | TPM_HAL_SetStopOnOverflowMode (TPM_Type *base, bool enable) | 
| Enables the TPM timer counter stop on selected trigger or not.  More... | |
| static void | TPM_HAL_EnableGlobalTimeBase (TPM_Type *base, bool enable) | 
| Enables the TPM timer global time base.  More... | |
| static void | TPM_HAL_SetDbgMode (TPM_Type *base, bool enable) | 
| Sets BDM mode.  More... | |
| static void | TPM_HAL_SetWaitMode (TPM_Type *base, bool enable) | 
| Sets the WAIT mode behavior.  More... | |
Variables | |
| const uint32_t | g_tpmChannelCount [TPM_INSTANCE_COUNT] | 
| Table of number of channels for each TPM instance.  | |
| struct tpm_pwm_param_t | 
Data Fields | |
| tpm_pwm_mode_t | mode | 
| TPM PWM operation mode.  | |
| tpm_pwm_edge_mode_t | edgeMode | 
| PWM output mode.  | |
| uint32_t | uFrequencyHZ | 
| PWM period in Hz.  | |
| uint32_t | uDutyCyclePercent | 
| PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)...  More... | |
| uint32_t tpm_pwm_param_t::uDutyCyclePercent | 
100=active signal (100% duty cycle).
| enum tpm_clock_mode_t | 
| enum tpm_trigger_source_t | 
| enum tpm_pwm_mode_t | 
| enum tpm_pwm_edge_mode_t | 
| enum tpm_status_t | 
| void TPM_HAL_Reset | ( | TPM_Type * | base, | 
| uint32_t | instance | ||
| ) | 
| base | TPM module base address pointer | 
| instance | The TPM peripheral instance number. | 
| void TPM_HAL_EnablePwmMode | ( | TPM_Type * | base, | 
| tpm_pwm_param_t * | config, | ||
| uint8_t | channel | ||
| ) | 
| base | TPM module base address pointer | 
| config | PWM configuration parameter | 
| channel | The TPM channel number. | 
| void TPM_HAL_DisableChn | ( | TPM_Type * | base, | 
| uint8_t | channel | ||
| ) | 
| base | TPM module base address pointer | 
| channel | The TPM channel number. | 
| void TPM_HAL_SetClockMode | ( | TPM_Type * | base, | 
| tpm_clock_mode_t | mode | ||
| ) | 
When disabling the TPM counter, the function waits till it receives an acknowledge from the TPM clock domain.
| base | TPM module base address pointer | 
| mode | The TPM counter clock mode (source). | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| ps | The TPM peripheral clock prescale divider | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| mode | 1 : upcounting mode 0:up_down counting mode. | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| val | The value to be set to the timer modulo | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
TPM channel operate mode, MSnB, and ELSnBA should be set at the same time.
| base | The TPM base address | 
| channel | The TPM peripheral channel number | 
| value | The value to set for MSnBA and ELSnBA | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| channel | The TPM peripheral channel number | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| channel | The TPM peripheral channel number | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| channel | The TPM peripheral channel number | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| channel | The TPM peripheral channel number | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| channel | The TPM peripheral channel number | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| channel | The TPM peripheral channel number. | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| channel | The TPM peripheral channel number. | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| channel | The TPM peripheral channel number. | 
| val | counter value to be set | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| channel | The TPM peripheral channel number. | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| tpm_status | TPM channel or overflow flag to clear | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| trigger_num | 0-15 | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| enable | true to enable, 1 to enable | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| enable | true to enable, false to disable. | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| enable | true to enable, false to disable. | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| enable | true to enable, false to disable. | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| enable | false pause, true continue work | 
      
  | 
  inlinestatic | 
| base | TPM module base address pointer | 
| enable | 0 continue running, 1 stop running |