STM32F4 Standard Peripheral bibliotheek
1.0
ST Microelectronics bibliotheek documentatie voor de STM32F4 Standard Peripheral Library
|
Output Compare management functions. More...
Functions | |
void | TIM_OC1Init (TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct) |
Initializes the TIMx Channel1 according to the specified parameters in the TIM_OCInitStruct. More... | |
void | TIM_OC2Init (TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct) |
Initializes the TIMx Channel2 according to the specified parameters in the TIM_OCInitStruct. More... | |
void | TIM_OC3Init (TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct) |
Initializes the TIMx Channel3 according to the specified parameters in the TIM_OCInitStruct. More... | |
void | TIM_OC4Init (TIM_TypeDef *TIMx, TIM_OCInitTypeDef *TIM_OCInitStruct) |
Initializes the TIMx Channel4 according to the specified parameters in the TIM_OCInitStruct. More... | |
void | TIM_OCStructInit (TIM_OCInitTypeDef *TIM_OCInitStruct) |
Fills each TIM_OCInitStruct member with its default value. More... | |
void | TIM_SelectOCxM (TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_OCMode) |
Selects the TIM Output Compare Mode. More... | |
void | TIM_SetCompare1 (TIM_TypeDef *TIMx, uint32_t Compare1) |
Sets the TIMx Capture Compare1 Register value. More... | |
void | TIM_SetCompare2 (TIM_TypeDef *TIMx, uint32_t Compare2) |
Sets the TIMx Capture Compare2 Register value. More... | |
void | TIM_SetCompare3 (TIM_TypeDef *TIMx, uint32_t Compare3) |
Sets the TIMx Capture Compare3 Register value. More... | |
void | TIM_SetCompare4 (TIM_TypeDef *TIMx, uint32_t Compare4) |
Sets the TIMx Capture Compare4 Register value. More... | |
void | TIM_ForcedOC1Config (TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) |
Forces the TIMx output 1 waveform to active or inactive level. More... | |
void | TIM_ForcedOC2Config (TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) |
Forces the TIMx output 2 waveform to active or inactive level. More... | |
void | TIM_ForcedOC3Config (TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) |
Forces the TIMx output 3 waveform to active or inactive level. More... | |
void | TIM_ForcedOC4Config (TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) |
Forces the TIMx output 4 waveform to active or inactive level. More... | |
void | TIM_OC1PreloadConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) |
Enables or disables the TIMx peripheral Preload register on CCR1. More... | |
void | TIM_OC2PreloadConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) |
Enables or disables the TIMx peripheral Preload register on CCR2. More... | |
void | TIM_OC3PreloadConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) |
Enables or disables the TIMx peripheral Preload register on CCR3. More... | |
void | TIM_OC4PreloadConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) |
Enables or disables the TIMx peripheral Preload register on CCR4. More... | |
void | TIM_OC1FastConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCFast) |
Configures the TIMx Output Compare 1 Fast feature. More... | |
void | TIM_OC2FastConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCFast) |
Configures the TIMx Output Compare 2 Fast feature. More... | |
void | TIM_OC3FastConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCFast) |
Configures the TIMx Output Compare 3 Fast feature. More... | |
void | TIM_OC4FastConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCFast) |
Configures the TIMx Output Compare 4 Fast feature. More... | |
void | TIM_ClearOC1Ref (TIM_TypeDef *TIMx, uint16_t TIM_OCClear) |
Clears or safeguards the OCREF1 signal on an external event. More... | |
void | TIM_ClearOC2Ref (TIM_TypeDef *TIMx, uint16_t TIM_OCClear) |
Clears or safeguards the OCREF2 signal on an external event. More... | |
void | TIM_ClearOC3Ref (TIM_TypeDef *TIMx, uint16_t TIM_OCClear) |
Clears or safeguards the OCREF3 signal on an external event. More... | |
void | TIM_ClearOC4Ref (TIM_TypeDef *TIMx, uint16_t TIM_OCClear) |
Clears or safeguards the OCREF4 signal on an external event. More... | |
void | TIM_OC1PolarityConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity) |
Configures the TIMx channel 1 polarity. More... | |
void | TIM_OC1NPolarityConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCNPolarity) |
Configures the TIMx Channel 1N polarity. More... | |
void | TIM_OC2PolarityConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity) |
Configures the TIMx channel 2 polarity. More... | |
void | TIM_OC2NPolarityConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCNPolarity) |
Configures the TIMx Channel 2N polarity. More... | |
void | TIM_OC3PolarityConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity) |
Configures the TIMx channel 3 polarity. More... | |
void | TIM_OC3NPolarityConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCNPolarity) |
Configures the TIMx Channel 3N polarity. More... | |
void | TIM_OC4PolarityConfig (TIM_TypeDef *TIMx, uint16_t TIM_OCPolarity) |
Configures the TIMx channel 4 polarity. More... | |
void | TIM_CCxCmd (TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCx) |
Enables or disables the TIM Capture Compare Channel x. More... | |
void | TIM_CCxNCmd (TIM_TypeDef *TIMx, uint16_t TIM_Channel, uint16_t TIM_CCxN) |
Enables or disables the TIM Capture Compare Channel xN. More... | |
Output Compare management functions.
=============================================================================== Output Compare management functions =============================================================================== =================================================================== TIM Driver: how to use it in Output Compare Mode =================================================================== To use the Timer in Output Compare mode, the following steps are mandatory: 1. Enable TIM clock using RCC_APBxPeriphClockCmd(RCC_APBxPeriph_TIMx, ENABLE) function 2. Configure the TIM pins by configuring the corresponding GPIO pins 2. 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 3. Fill the TIM_OCInitStruct with the desired parameters including: - The TIM Output Compare mode: TIM_OCMode - TIM Output State: TIM_OutputState - TIM Pulse value: TIM_Pulse - TIM Output Compare Polarity : TIM_OCPolarity 4. Call TIM_OCxInit(TIMx, &TIM_OCInitStruct) to configure the desired channel with the corresponding configuration 5. Call the TIM_Cmd(ENABLE) function to enable the TIM counter. Note1: All other functions can be used separately to modify, if needed, a specific feature of the Timer. Note2: In case of PWM mode, this function is mandatory: TIM_OCxPreloadConfig(TIMx, TIM_OCPreload_ENABLE); Note3: If the corresponding interrupt or DMA request are needed, the user should: 1. Enable the NVIC (or the DMA) to use the TIM interrupts (or DMA requests). 2. Enable the corresponding interrupt (or DMA request) using the function TIM_ITConfig(TIMx, TIM_IT_CCx) (or TIM_DMA_Cmd(TIMx, TIM_DMA_CCx))
void TIM_CCxCmd | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_Channel, | ||
uint16_t | TIM_CCx | ||
) |
Enables or disables the TIM Capture Compare Channel x.
TIMx,: | where x can be 1 to 14 except 6 and 7, to select the TIM peripheral. |
TIM_Channel,: | specifies the TIM Channel This parameter can be one of the following values:
|
TIM_CCx,: | specifies the TIM Channel CCxE bit new state. This parameter can be: TIM_CCx_Enable or TIM_CCx_Disable. |
None |
void TIM_CCxNCmd | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_Channel, | ||
uint16_t | TIM_CCxN | ||
) |
Enables or disables the TIM Capture Compare Channel xN.
TIMx,: | where x can be 1 or 8 to select the TIM peripheral. |
TIM_Channel,: | specifies the TIM Channel This parameter can be one of the following values:
|
TIM_CCxN,: | specifies the TIM Channel CCxNE bit new state. This parameter can be: TIM_CCxN_Enable or TIM_CCxN_Disable. |
None |
void TIM_ClearOC1Ref | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCClear | ||
) |
Clears or safeguards the OCREF1 signal on an external event.
TIMx,: | where x can be 1 to 14 except 6 and 7, to select the TIM peripheral. |
TIM_OCClear,: | new state of the Output Compare Clear Enable Bit. This parameter can be one of the following values:
|
None |
void TIM_ClearOC2Ref | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCClear | ||
) |
Clears or safeguards the OCREF2 signal on an external event.
TIMx,: | where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral. |
TIM_OCClear,: | new state of the Output Compare Clear Enable Bit. This parameter can be one of the following values:
|
None |
void TIM_ClearOC3Ref | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCClear | ||
) |
Clears or safeguards the OCREF3 signal on an external event.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCClear,: | new state of the Output Compare Clear Enable Bit. This parameter can be one of the following values:
|
None |
void TIM_ClearOC4Ref | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCClear | ||
) |
Clears or safeguards the OCREF4 signal on an external event.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCClear,: | new state of the Output Compare Clear Enable Bit. This parameter can be one of the following values:
|
None |
void TIM_ForcedOC1Config | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_ForcedAction | ||
) |
Forces the TIMx output 1 waveform to active or inactive level.
TIMx,: | where x can be 1 to 14 except 6 and 7, to select the TIM peripheral. |
TIM_ForcedAction,: | specifies the forced Action to be set to the output waveform. This parameter can be one of the following values:
|
None |
void TIM_ForcedOC2Config | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_ForcedAction | ||
) |
Forces the TIMx output 2 waveform to active or inactive level.
TIMx,: | where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral. |
TIM_ForcedAction,: | specifies the forced Action to be set to the output waveform. This parameter can be one of the following values:
|
None |
void TIM_ForcedOC3Config | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_ForcedAction | ||
) |
Forces the TIMx output 3 waveform to active or inactive level.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_ForcedAction,: | specifies the forced Action to be set to the output waveform. This parameter can be one of the following values:
|
None |
void TIM_ForcedOC4Config | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_ForcedAction | ||
) |
Forces the TIMx output 4 waveform to active or inactive level.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_ForcedAction,: | specifies the forced Action to be set to the output waveform. This parameter can be one of the following values:
|
None |
void TIM_OC1FastConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCFast | ||
) |
Configures the TIMx Output Compare 1 Fast feature.
TIMx,: | where x can be 1 to 14 except 6 and 7, to select the TIM peripheral. |
TIM_OCFast,: | new state of the Output Compare Fast Enable Bit. This parameter can be one of the following values:
|
None |
void TIM_OC1Init | ( | TIM_TypeDef * | TIMx, |
TIM_OCInitTypeDef * | TIM_OCInitStruct | ||
) |
Initializes the TIMx Channel1 according to the specified parameters in the TIM_OCInitStruct.
TIMx,: | where x can be 1 to 14 except 6 and 7, to select the TIM peripheral. |
TIM_OCInitStruct,: | pointer to a TIM_OCInitTypeDef structure that contains the configuration information for the specified TIM peripheral. |
None |
void TIM_OC1NPolarityConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCNPolarity | ||
) |
Configures the TIMx Channel 1N polarity.
TIMx,: | where x can be 1 or 8 to select the TIM peripheral. |
TIM_OCNPolarity,: | specifies the OC1N Polarity This parameter can be one of the following values:
|
None |
void TIM_OC1PolarityConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCPolarity | ||
) |
Configures the TIMx channel 1 polarity.
TIMx,: | where x can be 1 to 14 except 6 and 7, to select the TIM peripheral. |
TIM_OCPolarity,: | specifies the OC1 Polarity This parameter can be one of the following values:
|
None |
void TIM_OC1PreloadConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCPreload | ||
) |
Enables or disables the TIMx peripheral Preload register on CCR1.
TIMx,: | where x can be 1 to 14 except 6 and 7, to select the TIM peripheral. |
TIM_OCPreload,: | new state of the TIMx peripheral Preload register This parameter can be one of the following values:
|
None |
void TIM_OC2FastConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCFast | ||
) |
Configures the TIMx Output Compare 2 Fast feature.
TIMx,: | where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral. |
TIM_OCFast,: | new state of the Output Compare Fast Enable Bit. This parameter can be one of the following values:
|
None |
void TIM_OC2Init | ( | TIM_TypeDef * | TIMx, |
TIM_OCInitTypeDef * | TIM_OCInitStruct | ||
) |
Initializes the TIMx Channel2 according to the specified parameters in the TIM_OCInitStruct.
TIMx,: | where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral. |
TIM_OCInitStruct,: | pointer to a TIM_OCInitTypeDef structure that contains the configuration information for the specified TIM peripheral. |
None |
void TIM_OC2NPolarityConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCNPolarity | ||
) |
Configures the TIMx Channel 2N polarity.
TIMx,: | where x can be 1 or 8 to select the TIM peripheral. |
TIM_OCNPolarity,: | specifies the OC2N Polarity This parameter can be one of the following values:
|
None |
void TIM_OC2PolarityConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCPolarity | ||
) |
Configures the TIMx channel 2 polarity.
TIMx,: | where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral. |
TIM_OCPolarity,: | specifies the OC2 Polarity This parameter can be one of the following values:
|
None |
void TIM_OC2PreloadConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCPreload | ||
) |
Enables or disables the TIMx peripheral Preload register on CCR2.
TIMx,: | where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral. |
TIM_OCPreload,: | new state of the TIMx peripheral Preload register This parameter can be one of the following values:
|
None |
void TIM_OC3FastConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCFast | ||
) |
Configures the TIMx Output Compare 3 Fast feature.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCFast,: | new state of the Output Compare Fast Enable Bit. This parameter can be one of the following values:
|
None |
void TIM_OC3Init | ( | TIM_TypeDef * | TIMx, |
TIM_OCInitTypeDef * | TIM_OCInitStruct | ||
) |
Initializes the TIMx Channel3 according to the specified parameters in the TIM_OCInitStruct.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCInitStruct,: | pointer to a TIM_OCInitTypeDef structure that contains the configuration information for the specified TIM peripheral. |
None |
void TIM_OC3NPolarityConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCNPolarity | ||
) |
Configures the TIMx Channel 3N polarity.
TIMx,: | where x can be 1 or 8 to select the TIM peripheral. |
TIM_OCNPolarity,: | specifies the OC3N Polarity This parameter can be one of the following values:
|
None |
void TIM_OC3PolarityConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCPolarity | ||
) |
Configures the TIMx channel 3 polarity.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCPolarity,: | specifies the OC3 Polarity This parameter can be one of the following values:
|
None |
void TIM_OC3PreloadConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCPreload | ||
) |
Enables or disables the TIMx peripheral Preload register on CCR3.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCPreload,: | new state of the TIMx peripheral Preload register This parameter can be one of the following values:
|
None |
void TIM_OC4FastConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCFast | ||
) |
Configures the TIMx Output Compare 4 Fast feature.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCFast,: | new state of the Output Compare Fast Enable Bit. This parameter can be one of the following values:
|
None |
void TIM_OC4Init | ( | TIM_TypeDef * | TIMx, |
TIM_OCInitTypeDef * | TIM_OCInitStruct | ||
) |
Initializes the TIMx Channel4 according to the specified parameters in the TIM_OCInitStruct.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCInitStruct,: | pointer to a TIM_OCInitTypeDef structure that contains the configuration information for the specified TIM peripheral. |
None |
void TIM_OC4PolarityConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCPolarity | ||
) |
Configures the TIMx channel 4 polarity.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCPolarity,: | specifies the OC4 Polarity This parameter can be one of the following values:
|
None |
void TIM_OC4PreloadConfig | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_OCPreload | ||
) |
Enables or disables the TIMx peripheral Preload register on CCR4.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
TIM_OCPreload,: | new state of the TIMx peripheral Preload register This parameter can be one of the following values:
|
None |
void TIM_OCStructInit | ( | TIM_OCInitTypeDef * | TIM_OCInitStruct | ) |
Fills each TIM_OCInitStruct member with its default value.
TIM_OCInitStruct,: | pointer to a TIM_OCInitTypeDef structure which will be initialized. |
None |
void TIM_SelectOCxM | ( | TIM_TypeDef * | TIMx, |
uint16_t | TIM_Channel, | ||
uint16_t | TIM_OCMode | ||
) |
Selects the TIM Output Compare Mode.
TIMx,: | where x can be 1 to 14 except 6 and 7, to select the TIM peripheral. |
TIM_Channel,: | specifies the TIM Channel This parameter can be one of the following values:
|
TIM_OCMode,: | specifies the TIM Output Compare Mode. This parameter can be one of the following values:
|
None |
void TIM_SetCompare1 | ( | TIM_TypeDef * | TIMx, |
uint32_t | Compare1 | ||
) |
Sets the TIMx Capture Compare1 Register value.
TIMx,: | where x can be 1 to 14 except 6 and 7, to select the TIM peripheral. |
Compare1,: | specifies the Capture Compare1 register new value. |
None |
void TIM_SetCompare2 | ( | TIM_TypeDef * | TIMx, |
uint32_t | Compare2 | ||
) |
Sets the TIMx Capture Compare2 Register value.
TIMx,: | where x can be 1, 2, 3, 4, 5, 8, 9 or 12 to select the TIM peripheral. |
Compare2,: | specifies the Capture Compare2 register new value. |
None |
void TIM_SetCompare3 | ( | TIM_TypeDef * | TIMx, |
uint32_t | Compare3 | ||
) |
Sets the TIMx Capture Compare3 Register value.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
Compare3,: | specifies the Capture Compare3 register new value. |
None |
void TIM_SetCompare4 | ( | TIM_TypeDef * | TIMx, |
uint32_t | Compare4 | ||
) |
Sets the TIMx Capture Compare4 Register value.
TIMx,: | where x can be 1, 2, 3, 4, 5 or 8 to select the TIM peripheral. |
Compare4,: | specifies the Capture Compare4 register new value. |
None |