Rajath Ravi / Mbed 2 deprecated ravi_blinkycode

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Input Capture management functions

Input Capture management functions
[TIM_Private_Functions]

Input Capture management functions. More...

Functions

void TIM_ICInit_mort (TIM_TypeDef_mort *TIMx, TIM_ICInitTypeDef_mort *TIM_ICInitStruct)
 Initializes the TIM peripheral according to the specified parameters in the TIM_ICInitStruct.
void TIM_ICStructInit_mort (TIM_ICInitTypeDef_mort *TIM_ICInitStruct)
 Fills each TIM_ICInitStruct member with its default value.
void TIM_PWMIConfig_mort (TIM_TypeDef_mort *TIMx, TIM_ICInitTypeDef_mort *TIM_ICInitStruct)
 Configures the TIM peripheral according to the specified parameters in the TIM_ICInitStruct to measure an external PWM signal.
uint32_t TIM_GetCapture1_mort (TIM_TypeDef_mort *TIMx)
 Gets the TIMx Input Capture 1 value.
uint32_t TIM_GetCapture2_mort (TIM_TypeDef_mort *TIMx)
 Gets the TIMx Input Capture 2 value.
uint32_t TIM_GetCapture3_mort (TIM_TypeDef_mort *TIMx)
 Gets the TIMx Input Capture 3 value.
uint32_t TIM_GetCapture4_mort (TIM_TypeDef_mort *TIMx)
 Gets the TIMx Input Capture 4 value.
void TIM_SetIC1Prescaler_mort (TIM_TypeDef_mort *TIMx, uint16_t TIM_ICPSC)
 Sets the TIMx Input Capture 1 prescaler.
void TIM_SetIC2Prescaler_mort (TIM_TypeDef_mort *TIMx, uint16_t TIM_ICPSC)
 Sets the TIMx Input Capture 2 prescaler.
void TIM_SetIC3Prescaler_mort (TIM_TypeDef_mort *TIMx, uint16_t TIM_ICPSC)
 Sets the TIMx Input Capture 3 prescaler.
void TIM_SetIC4Prescaler_mort (TIM_TypeDef_mort *TIMx, uint16_t TIM_ICPSC)
 Sets the TIMx Input Capture 4 prescaler.

Detailed Description

Input Capture management functions.

 ===============================================================================
                  ##### Input Capture management functions #####
 ===============================================================================  
         
            ##### TIM Driver: how to use it in Input Capture Mode #####
 ===============================================================================
    [..]    
    To use the Timer in Input Capture mode, the following steps are mandatory:
       
      (#) Enable TIM clock using RCC_APBxPeriphClockCmd(RCC_APBxPeriph_TIMx, ENABLE) 
          function
       
      (#) Configure the TIM pins by configuring the corresponding GPIO pins
       
      (#) Configure the Time base unit as described in the first part of this driver,
          if needed, else the Timer will run with the default configuration:
        (++) Autoreload value = 0xFFFF
        (++) Prescaler value = 0x0000
        (++) Counter mode = Up counting
        (++) Clock Division = TIM_CKD_DIV1_MORT
          
      (#) Fill the TIM_ICInitStruct with the desired parameters including:
        (++) TIM Channel: TIM_Channel
        (++) TIM Input Capture polarity: TIM_ICPolarity
        (++) TIM Input Capture selection: TIM_ICSelection
        (++) TIM Input Capture Prescaler: TIM_ICPrescaler
        (++) TIM Input Capture filter value: TIM_ICFilter
       
      (#) Call TIM_ICInit_mort(TIMx, &TIM_ICInitStruct) to configure the desired channel 
          with the corresponding configuration and to measure only frequency 
          or duty cycle of the input signal, or, Call TIM_PWMIConfig_mort(TIMx, &TIM_ICInitStruct) 
          to configure the desired channels with the corresponding configuration 
          and to measure the frequency and the duty cycle of the input signal
          
      (#) Enable the NVIC or the DMA to read the measured frequency. 
          
      (#) Enable the corresponding interrupt (or DMA request) to read the Captured 
          value, using the function TIM_ITConfig_mort(TIMx, TIM_IT_CCx) 
          (or TIM_DMA_Cmd(TIMx, TIM_DMA_CCx)) 
       
      (#) Call the TIM_Cmd(ENABLE) function to enable the TIM counter.
       
      (#) Use TIM_GetCapturex(TIMx); to read the captured value.
       
      -@- All other functions can be used separately to modify, if needed,
          a specific feature of the Timer. 


Function Documentation

uint32_t TIM_GetCapture1_mort ( TIM_TypeDef_mort *  TIMx )

Gets the TIMx Input Capture 1 value.

Parameters:
TIMx,:where x can be 1 to 14 except 6 and 7, to select the TIM peripheral.
Return values:
CaptureCompare 1 Register value.

Definition at line 2032 of file stm32f4xx_tim_mort.c.

uint32_t TIM_GetCapture2_mort ( TIM_TypeDef_mort *  TIMx )

Gets the TIMx Input Capture 2 value.

Parameters:
TIMx,:where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral.
Return values:
CaptureCompare 2 Register value.

Definition at line 2047 of file stm32f4xx_tim_mort.c.

uint32_t TIM_GetCapture3_mort ( TIM_TypeDef_mort *  TIMx )

Gets the TIMx Input Capture 3 value.

Parameters:
TIMx,:where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral.
Return values:
CaptureCompare 3 Register value.

Definition at line 2061 of file stm32f4xx_tim_mort.c.

uint32_t TIM_GetCapture4_mort ( TIM_TypeDef_mort *  TIMx )

Gets the TIMx Input Capture 4 value.

Parameters:
TIMx,:where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral.
Return values:
CaptureCompare 4 Register value.

Definition at line 2075 of file stm32f4xx_tim_mort.c.

void TIM_ICInit_mort ( TIM_TypeDef_mort *  TIMx,
TIM_ICInitTypeDef_mort *  TIM_ICInitStruct 
)

Initializes the TIM peripheral according to the specified parameters in the TIM_ICInitStruct.

Parameters:
TIMx,:where x can be 1 to 14 except 6 and 7, to select the TIM peripheral.
TIM_ICInitStruct,:pointer to a TIM_ICInitTypeDef_mort structure that contains the configuration information for the specified TIM peripheral.
Return values:
None

Definition at line 1900 of file stm32f4xx_tim_mort.c.

void TIM_ICStructInit_mort ( TIM_ICInitTypeDef_mort *  TIM_ICInitStruct )

Fills each TIM_ICInitStruct member with its default value.

Parameters:
TIM_ICInitStruct,:pointer to a TIM_ICInitTypeDef_mort structure which will be initialized.
Return values:
None

Definition at line 1956 of file stm32f4xx_tim_mort.c.

void TIM_PWMIConfig_mort ( TIM_TypeDef_mort *  TIMx,
TIM_ICInitTypeDef_mort *  TIM_ICInitStruct 
)

Configures the TIM peripheral according to the specified parameters in the TIM_ICInitStruct to measure an external PWM signal.

Parameters:
TIMx,:where x can be 1, 2, 3, 4, 5,8, 9 or 12 to select the TIM peripheral.
TIM_ICInitStruct,:pointer to a TIM_ICInitTypeDef_mort structure that contains the configuration information for the specified TIM peripheral.
Return values:
None

Definition at line 1975 of file stm32f4xx_tim_mort.c.

void TIM_SetIC1Prescaler_mort ( TIM_TypeDef_mort *  TIMx,
uint16_t  TIM_ICPSC 
)

Sets the TIMx Input Capture 1 prescaler.

Parameters:
TIMx,:where x can be 1 to 14 except 6 and 7, to select the TIM peripheral.
TIM_ICPSC,:specifies the Input Capture1 prescaler new value. This parameter can be one of the following values:

  • TIM_ICPSC_DIV1_MORT: no prescaler
  • TIM_ICPSC_DIV2_MORT: capture is done once every 2 events
  • TIM_ICPSC_DIV4_MORT: capture is done once every 4 events
  • TIM_ICPSC_DIV8_MORT: capture is done once every 8 events
Return values:
None

Definition at line 2095 of file stm32f4xx_tim_mort.c.

void TIM_SetIC2Prescaler_mort ( TIM_TypeDef_mort *  TIMx,
uint16_t  TIM_ICPSC 
)

Sets the TIMx Input Capture 2 prescaler.

Parameters:
TIMx,:where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral.
TIM_ICPSC,:specifies the Input Capture2 prescaler new value. This parameter can be one of the following values:

  • TIM_ICPSC_DIV1_MORT: no prescaler
  • TIM_ICPSC_DIV2_MORT: capture is done once every 2 events
  • TIM_ICPSC_DIV4_MORT: capture is done once every 4 events
  • TIM_ICPSC_DIV8_MORT: capture is done once every 8 events
Return values:
None

Definition at line 2120 of file stm32f4xx_tim_mort.c.

void TIM_SetIC3Prescaler_mort ( TIM_TypeDef_mort *  TIMx,
uint16_t  TIM_ICPSC 
)

Sets the TIMx Input Capture 3 prescaler.

Parameters:
TIMx,:where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral.
TIM_ICPSC,:specifies the Input Capture3 prescaler new value. This parameter can be one of the following values:

  • TIM_ICPSC_DIV1_MORT: no prescaler
  • TIM_ICPSC_DIV2_MORT: capture is done once every 2 events
  • TIM_ICPSC_DIV4_MORT: capture is done once every 4 events
  • TIM_ICPSC_DIV8_MORT: capture is done once every 8 events
Return values:
None

Definition at line 2144 of file stm32f4xx_tim_mort.c.

void TIM_SetIC4Prescaler_mort ( TIM_TypeDef_mort *  TIMx,
uint16_t  TIM_ICPSC 
)

Sets the TIMx Input Capture 4 prescaler.

Parameters:
TIMx,:where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral.
TIM_ICPSC,:specifies the Input Capture4 prescaler new value. This parameter can be one of the following values:

  • TIM_ICPSC_DIV1_MORT: no prescaler
  • TIM_ICPSC_DIV2_MORT: capture is done once every 2 events
  • TIM_ICPSC_DIV4_MORT: capture is done once every 4 events
  • TIM_ICPSC_DIV8_MORT: capture is done once every 8 events
Return values:
None

Definition at line 2168 of file stm32f4xx_tim_mort.c.