![]()  | 
  
    Kinetis SDK v.2.0 API Reference Manual
    Rev. 0
    
   Freescale Semiconductor, Inc. 
   | 
 
The KSDK provides a driver for the PIT module of Kinetis devices.
Files | |
| file | fsl_pit.h | 
Data Structures | |
| struct | pit_config_t | 
| PIT config structure.  More... | |
Enumerations | |
| enum | pit_chnl_t {  kPIT_Chnl_0 = 0U, kPIT_Chnl_1, kPIT_Chnl_2, kPIT_Chnl_3 }  | 
| List of PIT channels.  More... | |
| enum | pit_interrupt_enable_t { kPIT_TimerInterruptEnable = PIT_TCTRL_TIE_MASK } | 
| List of PIT interrupts.  More... | |
| enum | pit_status_flags_t { kPIT_TimerFlag = PIT_TFLG_TIF_MASK } | 
| List of PIT status flags.  More... | |
Driver version | |
| #define | FSL_PIT_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) | 
| Version 2.0.0.  | |
Initialization and deinitialization | |
| void | PIT_Init (PIT_Type *base, const pit_config_t *config) | 
| Ungates the PIT clock, enables the PIT module and configures the peripheral for basic operation.  More... | |
| void | PIT_Deinit (PIT_Type *base) | 
| Gate the PIT clock and disable the PIT module.  More... | |
| static void | PIT_GetDefaultConfig (pit_config_t *config) | 
| Fill in the PIT config struct with the default settings.  More... | |
Interrupt Interface | |
| static void | PIT_EnableInterrupts (PIT_Type *base, pit_chnl_t channel, uint32_t mask) | 
| Enables the selected PIT interrupts.  More... | |
| static void | PIT_DisableInterrupts (PIT_Type *base, pit_chnl_t channel, uint32_t mask) | 
| Disables the selected PIT interrupts.  More... | |
| static uint32_t | PIT_GetEnabledInterrupts (PIT_Type *base, pit_chnl_t channel) | 
| Gets the enabled PIT interrupts.  More... | |
Status Interface | |
| static uint32_t | PIT_GetStatusFlags (PIT_Type *base, pit_chnl_t channel) | 
| Gets the PIT status flags.  More... | |
| static void | PIT_ClearStatusFlags (PIT_Type *base, pit_chnl_t channel, uint32_t mask) | 
| Clears the PIT status flags.  More... | |
Read and Write the timer period | |
| static void | PIT_SetTimerPeriod (PIT_Type *base, pit_chnl_t channel, uint32_t count) | 
| Sets the timer period in units of count.  More... | |
| static uint32_t | PIT_GetCurrentTimerCount (PIT_Type *base, pit_chnl_t channel) | 
| Reads the current timer counting value.  More... | |
Timer Start and Stop | |
| static void | PIT_StartTimer (PIT_Type *base, pit_chnl_t channel) | 
| Starts the timer counting.  More... | |
| static void | PIT_StopTimer (PIT_Type *base, pit_chnl_t channel) | 
| Stops the timer counting.  More... | |
| struct pit_config_t | 
This structure holds the configuration settings for the PIT peripheral. To initialize this structure to reasonable defaults, call the PIT_GetDefaultConfig() function and pass a pointer to your config structure instance.
The config struct can be made const so it resides in flash
Data Fields | |
| bool | enableRunInDebug | 
| true: Timers run in debug mode; false: Timers stop in debug mode  | |
| enum pit_chnl_t | 
| enum pit_status_flags_t | 
| void PIT_Init | ( | PIT_Type * | base, | 
| const pit_config_t * | config | ||
| ) | 
| base | PIT peripheral base address | 
| config | Pointer to user's PIT config structure | 
| void PIT_Deinit | ( | PIT_Type * | base | ) | 
| base | PIT peripheral base address | 
      
  | 
  inlinestatic | 
The default values are:
| config | Pointer to user's PIT config structure. | 
      
  | 
  inlinestatic | 
| base | PIT peripheral base address | 
| channel | Timer channel number | 
| mask | The interrupts to enable. This is a logical OR of members of the enumeration pit_interrupt_enable_t | 
      
  | 
  inlinestatic | 
| base | PIT peripheral base address | 
| channel | Timer channel number | 
| mask | The interrupts to disable. This is a logical OR of members of the enumeration pit_interrupt_enable_t | 
      
  | 
  inlinestatic | 
| base | PIT peripheral base address | 
| channel | Timer channel number | 
      
  | 
  inlinestatic | 
| base | PIT peripheral base address | 
| channel | Timer channel number | 
      
  | 
  inlinestatic | 
| base | PIT peripheral base address | 
| channel | Timer channel number | 
| mask | The status flags to clear. This is a logical OR of members of the enumeration pit_status_flags_t | 
      
  | 
  inlinestatic | 
Timers begin counting from the value set by this function until it reaches 0, then it will generate an interrupt and load this regiter value again. Writing a new value to this register will not restart the timer; instead the value will be loaded after the timer expires.
| base | PIT peripheral base address | 
| channel | Timer channel number | 
| count | Timer period in units of ticks | 
      
  | 
  inlinestatic | 
This function returns the real-time timer counting value, in a range from 0 to a timer period.
| base | PIT peripheral base address | 
| channel | Timer channel number | 
      
  | 
  inlinestatic | 
After calling this function, timers load period value, count down to 0 and then load the respective start value again. Each time a timer reaches 0, it generates a trigger pulse and sets the timeout interrupt flag.
| base | PIT peripheral base address | 
| channel | Timer channel number. | 
      
  | 
  inlinestatic | 
This function stops every timer counting. Timers reload their periods respectively after the next time they call the PIT_DRV_StartTimer.
| base | PIT peripheral base address | 
| channel | Timer channel number. |