bf0_hal_tim.h

Header file of TIM HAL module.

Author

Sifli software development team

Attention

Defines

GPT_INPUTCHANNELPOLARITY_RISING

Polarity for TIx source

GPT_INPUTCHANNELPOLARITY_FALLING

Polarity for TIx source

GPT_INPUTCHANNELPOLARITY_BOTHEDGE

Polarity for TIx source

GPT_ETRPOLARITY_INVERTED

Polarity for ETR source

GPT_ETRPOLARITY_NONINVERTED

Polarity for ETR source

GPT_ETRPRESCALER_DIV1

No prescaler is used

GPT_ETRPRESCALER_DIV2

ETR input source is divided by 2

GPT_ETRPRESCALER_DIV4

ETR input source is divided by 4

GPT_ETRPRESCALER_DIV8

ETR input source is divided by 8

GPT_COUNTERMODE_UP
GPT_COUNTERMODE_DOWN
GPT_COUNTERMODE_CENTERALIGNED3
GPT_OCMODE_TIMING
GPT_OCMODE_ACTIVE
GPT_OCMODE_INACTIVE
GPT_OCMODE_TOGGLE
GPT_OCMODE_PWM1
GPT_OCMODE_PWM2
GPT_OCMODE_FORCED_ACTIVE
GPT_OCMODE_FORCED_INACTIVE
TIM_CHANNEL_1
TIM_CHANNEL_2
TIM_CHANNEL_3
TIM_CHANNEL_4
TIM_CHANNEL_5

Compare channel 5 identifier

TIM_CHANNEL_6

Compare channel 6 identifier

TIM_CHANNEL_ALL

Global Capture/compare channel identifier

GPT_OCFAST_DISABLE
GPT_OCFAST_ENABLE
GPT_OCPOLARITY_HIGH
GPT_OCPOLARITY_LOW
GPT_OCNPOLARITY_HIGH
GPT_OCNPOLARITY_LOW
GPT_OCIDLESTATE_SET
GPT_OCIDLESTATE_RESET
GPT_OCNIDLESTATE_SET
GPT_OCNIDLESTATE_RESET
GPT_CHANNEL_1
GPT_CHANNEL_2
GPT_CHANNEL_3
GPT_CHANNEL_4
GPT_CHANNEL_ALL
GPT_ICPOLARITY_RISING
GPT_ICPOLARITY_FALLING
GPT_ICPOLARITY_BOTHEDGE
GPT_ICSELECTION_DIRECTTI

TIM Input 1, 2, 3 or 4 is selected to be connected to IC1, IC2, IC3 or IC4, respectively

GPT_ICSELECTION_INDIRECTTI

TIM Input 1, 2, 3 or 4 is selected to be connected to IC2, IC1, IC4 or IC3, respectively

GPT_ICSELECTION_TRC

TIM Input 1, 2, 3 or 4 is selected to be connected to TRC

GPT_ICPSC_DIV1

Capture performed each time an edge is detected on the capture input

GPT_ICPSC_DIV2

Capture performed once every 2 events

GPT_ICPSC_DIV4

Capture performed once every 4 events

GPT_ICPSC_DIV8

Capture performed once every 8 events

GPT_OPMODE_SINGLE
GPT_OPMODE_REPETITIVE
GPT_ENCODERMODE_TI1
GPT_ENCODERMODE_TI2
GPT_ENCODERMODE_TI3
GPT_IT_UPDATE
GPT_IT_CC1
GPT_IT_CC2
GPT_IT_CC3
GPT_IT_CC4
GPT_IT_COM
GPT_IT_TRIGGER
GPT_IT_BREAK
GPT_COMMUTATION_TRGI
GPT_COMMUTATION_SOFTWARE
GPT_DMA_UPDATE
GPT_DMA_CC1
GPT_DMA_CC2
GPT_DMA_CC3
GPT_DMA_CC4
GPT_DMA_COM
GPT_DMA_TRIGGER
GPT_EVENTSOURCE_UPDATE
GPT_EVENTSOURCE_CC1
GPT_EVENTSOURCE_CC2
GPT_EVENTSOURCE_CC3
GPT_EVENTSOURCE_CC4
GPT_EVENTSOURCE_COM
GPT_EVENTSOURCE_TRIGGER
GPT_EVENTSOURCE_BREAK
GPT_FLAG_UPDATE
GPT_FLAG_CC1
GPT_FLAG_CC2
GPT_FLAG_CC3
GPT_FLAG_CC4
GPT_FLAG_COM
GPT_FLAG_TRIGGER
GPT_FLAG_BREAK
GPT_FLAG_CC1OF
GPT_FLAG_CC2OF
GPT_FLAG_CC3OF
GPT_FLAG_CC4OF
GPT_CLOCKSOURCE_ETRMODE2
GPT_CLOCKSOURCE_INTERNAL
GPT_CLOCKSOURCE_ITR0
GPT_CLOCKSOURCE_ITR1
GPT_CLOCKSOURCE_ITR2
GPT_CLOCKSOURCE_ITR3
GPT_CLOCKSOURCE_TI1ED
GPT_CLOCKSOURCE_TI1
GPT_CLOCKSOURCE_TI2
GPT_CLOCKSOURCE_ETRMODE1
GPT_CLOCKPOLARITY_INVERTED

Polarity for ETRx clock sources

GPT_CLOCKPOLARITY_NONINVERTED

Polarity for ETRx clock sources

GPT_CLOCKPOLARITY_RISING

Polarity for TIx clock sources

GPT_CLOCKPOLARITY_FALLING

Polarity for TIx clock sources

GPT_CLOCKPOLARITY_BOTHEDGE

Polarity for TIx clock sources

GPT_CLOCKPRESCALER_DIV1

No prescaler is used

GPT_CLOCKPRESCALER_DIV2

Prescaler for External ETR Clock: Capture performed once every 2 events.

GPT_CLOCKPRESCALER_DIV4

Prescaler for External ETR Clock: Capture performed once every 4 events.

GPT_CLOCKPRESCALER_DIV8

Prescaler for External ETR Clock: Capture performed once every 8 events.

GPT_CLEARINPUTSOURCE_ETR
GPT_CLEARINPUTSOURCE_NONE
GPT_CLEARINPUTPOLARITY_INVERTED

Polarity for ETRx pin

GPT_CLEARINPUTPOLARITY_NONINVERTED

Polarity for ETRx pin

GPT_CLEARINPUTPRESCALER_DIV1

No prescaler is used

GPT_CLEARINPUTPRESCALER_DIV2

Prescaler for External ETR pin: Capture performed once every 2 events.

GPT_CLEARINPUTPRESCALER_DIV4

Prescaler for External ETR pin: Capture performed once every 4 events.

GPT_CLEARINPUTPRESCALER_DIV8

Prescaler for External ETR pin: Capture performed once every 8 events.

GPT_OSSR_ENABLE
GPT_OSSR_DISABLE
GPT_OSSI_ENABLE
GPT_OSSI_DISABLE
GPT_LOCKLEVEL_OFF
GPT_LOCKLEVEL_1
GPT_LOCKLEVEL_2
GPT_LOCKLEVEL_3
GPT_BREAK_ENABLE
GPT_BREAK_DISABLE
GPT_BREAKPOLARITY_LOW
GPT_BREAKPOLARITY_HIGH
GPT_AUTOMATICOUTPUT_ENABLE
GPT_AUTOMATICOUTPUT_DISABLE
GPT_CR2_MMS_0
GPT_CR2_MMS_1
GPT_CR2_MMS_2
GPT_TRGO_RESET
GPT_TRGO_ENABLE
GPT_TRGO_UPDATE
GPT_TRGO_OC1
GPT_TRGO_OC1REF
GPT_TRGO_OC2REF
GPT_TRGO_OC3REF
GPT_TRGO_OC4REF
GPT_SLAVEMODE_DISABLE
GPT_SLAVEMODE_RESET
GPT_SLAVEMODE_GATED
GPT_SLAVEMODE_TRIGGER
GPT_SLAVEMODE_EXTERNAL1
GPT_MASTERSLAVEMODE_ENABLE
GPT_MASTERSLAVEMODE_DISABLE
GPT_TS_ITR0
GPT_TS_ITR1
GPT_TS_ITR2
GPT_TS_ITR3
GPT_TS_TI1F_ED
GPT_TS_TI1FP1
GPT_TS_TI2FP2
GPT_TS_ETRF
GPT_TS_NONE
GPT_TRIGGERPOLARITY_INVERTED

Polarity for ETRx trigger sources

GPT_TRIGGERPOLARITY_NONINVERTED

Polarity for ETRx trigger sources

GPT_TRIGGERPOLARITY_RISING

Polarity for TIxFPx or TI1_ED trigger sources

GPT_TRIGGERPOLARITY_FALLING

Polarity for TIxFPx or TI1_ED trigger sources

GPT_TRIGGERPOLARITY_BOTHEDGE

Polarity for TIxFPx or TI1_ED trigger sources

GPT_TRIGGERPRESCALER_DIV1

No prescaler is used

GPT_TRIGGERPRESCALER_DIV2

Prescaler for External ETR Trigger: Capture performed once every 2 events.

GPT_TRIGGERPRESCALER_DIV4

Prescaler for External ETR Trigger: Capture performed once every 4 events.

GPT_TRIGGERPRESCALER_DIV8

Prescaler for External ETR Trigger: Capture performed once every 8 events.

GPT_TI1SELECTION_CH1
GPT_TI1SELECTION_XORCOMBINATION
GPT_DMABASE_CR1
GPT_DMABASE_CR2
GPT_DMABASE_SMCR
GPT_DMABASE_DIER
GPT_DMABASE_SR
GPT_DMABASE_EGR
GPT_DMABASE_CCMR1
GPT_DMABASE_CCMR2
GPT_DMABASE_CCER
GPT_DMABASE_CNT
GPT_DMABASE_PSC
GPT_DMABASE_ARR
GPT_DMABASE_RCR
GPT_DMABASE_CCR1
GPT_DMABASE_CCR2
GPT_DMABASE_CCR3
GPT_DMABASE_CCR4
GPT_DMABASE_BDTR
GPT_DMABASE_DCR
GPT_DMABASE_OR
GPT_DMABURSTLENGTH_1TRANSFER
GPT_DMABURSTLENGTH_2TRANSFERS
GPT_DMABURSTLENGTH_3TRANSFERS
GPT_DMABURSTLENGTH_4TRANSFERS
GPT_DMABURSTLENGTH_5TRANSFERS
GPT_DMABURSTLENGTH_6TRANSFERS
GPT_DMABURSTLENGTH_7TRANSFERS
GPT_DMABURSTLENGTH_8TRANSFERS
GPT_DMABURSTLENGTH_9TRANSFERS
GPT_DMABURSTLENGTH_10TRANSFERS
GPT_DMABURSTLENGTH_11TRANSFERS
GPT_DMABURSTLENGTH_12TRANSFERS
GPT_DMABURSTLENGTH_13TRANSFERS
GPT_DMABURSTLENGTH_14TRANSFERS
GPT_DMABURSTLENGTH_15TRANSFERS
GPT_DMABURSTLENGTH_16TRANSFERS
GPT_DMABURSTLENGTH_17TRANSFERS
GPT_DMABURSTLENGTH_18TRANSFERS
GPT_DMA_ID_UPDATE

Index of the DMA handle used for Update DMA requests

GPT_DMA_ID_CC1

Index of the DMA handle used for Capture/Compare 1 DMA requests

GPT_DMA_ID_CC2

Index of the DMA handle used for Capture/Compare 2 DMA requests

GPT_DMA_ID_CC3

Index of the DMA handle used for Capture/Compare 3 DMA requests

GPT_DMA_ID_CC4

Index of the DMA handle used for Capture/Compare 4 DMA requests

GPT_DMA_ID_COMMUTATION

Index of the DMA handle used for Commutation DMA requests

GPT_DMA_ID_TRIGGER

Index of the DMA handle used for Trigger DMA requests

GPT_CCx_ENABLE
GPT_CCx_DISABLE
GPT_CCxN_ENABLE
GPT_CCxN_DISABLE
__HAL_GPT_RESET_HANDLE_STATE(__HANDLE__)

Reset TIM handle state.

参数:
  • __HANDLE__ – TIM handle

返回值:

None

__HAL_GPT_ENABLE(__HANDLE__)

Enable the TIM peripheral.

参数:
  • __HANDLE__ – TIM handle

返回值:

None

__HAL_GPT_IS_ENABLED(__INSTANCE__)
__HAL_GPT_MOE_ENABLE(__HANDLE__)

Enable the TIM main Output.

参数:
  • __HANDLE__ – TIM handle

返回值:

None

__HAL_GPT_DISABLE(__HANDLE__)

Disable the TIM peripheral.

参数:
  • __HANDLE__ – TIM handle

返回值:

None

__HAL_GPT_MOE_DISABLE(__HANDLE__)

Disable the TIM main Output.

参数:
  • __HANDLE__ – TIM handle

返回值:

None

__HAL_GPT_MOE_DISABLE_UNCONDITIONALLY(__HANDLE__)

Disable the TIM main Output.

备注

The Main Output Enable of a timer instance is disabled unconditionally

参数:
  • __HANDLE__ – TIM handle

返回值:

None

__HAL_GPT_ENABLE_IT(__HANDLE__, __INTERRUPT__)

Enable the specified TIM interrupt.

参数:
  • __HANDLE__ – specifies the TIM Handle.

  • __INTERRUPT__ – specifies the TIM interrupt source to enable. This parameter can be one of the following values:

    • GPT_IT_UPDATE: Update interrupt

    • GPT_IT_CC1: Capture/Compare 1 interrupt

    • GPT_IT_CC2: Capture/Compare 2 interrupt

    • GPT_IT_CC3: Capture/Compare 3 interrupt

    • GPT_IT_CC4: Capture/Compare 4 interrupt

    • GPT_IT_COM: Commutation interrupt

    • GPT_IT_TRIGGER: Trigger interrupt

    • GPT_IT_BREAK: Break interrupt

返回值:

None

__HAL_GPT_DISABLE_IT(__HANDLE__, __INTERRUPT__)

Disable the specified TIM interrupt.

参数:
  • __HANDLE__ – specifies the TIM Handle.

  • __INTERRUPT__ – specifies the TIM interrupt source to disable. This parameter can be one of the following values:

    • GPT_IT_UPDATE: Update interrupt

    • GPT_IT_CC1: Capture/Compare 1 interrupt

    • GPT_IT_CC2: Capture/Compare 2 interrupt

    • GPT_IT_CC3: Capture/Compare 3 interrupt

    • GPT_IT_CC4: Capture/Compare 4 interrupt

    • GPT_IT_COM: Commutation interrupt

    • GPT_IT_TRIGGER: Trigger interrupt

    • GPT_IT_BREAK: Break interrupt

返回值:

None

__HAL_GPT_ENABLE_DMA(__HANDLE__, __DMA__)

Enable the specified DMA request.

参数:
  • __HANDLE__ – specifies the TIM Handle.

  • __DMA__ – specifies the TIM DMA request to enable. This parameter can be one of the following values:

    • GPT_DMA_UPDATE: Update DMA request

    • GPT_DMA_CC1: Capture/Compare 1 DMA request

    • GPT_DMA_CC2: Capture/Compare 2 DMA request

    • GPT_DMA_CC3: Capture/Compare 3 DMA request

    • GPT_DMA_CC4: Capture/Compare 4 DMA request

    • GPT_DMA_COM: Commutation DMA request

    • GPT_DMA_TRIGGER: Trigger DMA request

返回值:

None

__HAL_GPT_DISABLE_DMA(__HANDLE__, __DMA__)

Disable the specified DMA request.

参数:
  • __HANDLE__ – specifies the TIM Handle.

  • __DMA__ – specifies the TIM DMA request to disable. This parameter can be one of the following values:

    • GPT_DMA_UPDATE: Update DMA request

    • GPT_DMA_CC1: Capture/Compare 1 DMA request

    • GPT_DMA_CC2: Capture/Compare 2 DMA request

    • GPT_DMA_CC3: Capture/Compare 3 DMA request

    • GPT_DMA_CC4: Capture/Compare 4 DMA request

    • GPT_DMA_COM: Commutation DMA request

    • GPT_DMA_TRIGGER: Trigger DMA request

返回值:

None

__HAL_GPT_GET_FLAG(__HANDLE__, __FLAG__)

Check whether the specified TIM interrupt flag is set or not.

参数:
  • __HANDLE__ – specifies the TIM Handle.

  • __FLAG__ – specifies the TIM interrupt flag to check. This parameter can be one of the following values:

    • GPT_FLAG_UPDATE: Update interrupt flag

    • GPT_FLAG_CC1: Capture/Compare 1 interrupt flag

    • GPT_FLAG_CC2: Capture/Compare 2 interrupt flag

    • GPT_FLAG_CC3: Capture/Compare 3 interrupt flag

    • GPT_FLAG_CC4: Capture/Compare 4 interrupt flag

    • GPT_FLAG_CC5: Compare 5 interrupt flag

    • GPT_FLAG_CC6: Compare 6 interrupt flag

    • GPT_FLAG_COM: Commutation interrupt flag

    • GPT_FLAG_TRIGGER: Trigger interrupt flag

    • GPT_FLAG_BREAK: Break interrupt flag

    • GPT_FLAG_BREAK2: Break 2 interrupt flag

    • GPT_FLAG_SYSTEM_BREAK: System Break interrupt flag

    • GPT_FLAG_CC1OF: Capture/Compare 1 overcapture flag

    • GPT_FLAG_CC2OF: Capture/Compare 2 overcapture flag

    • GPT_FLAG_CC3OF: Capture/Compare 3 overcapture flag

    • GPT_FLAG_CC4OF: Capture/Compare 4 overcapture flag

返回值:

The – new state of FLAG (TRUE or FALSE).

__HAL_GPT_CLEAR_FLAG(__HANDLE__, __FLAG__)

Clear the specified TIM interrupt flag.

参数:
  • __HANDLE__ – specifies the TIM Handle.

  • __FLAG__ – specifies the TIM interrupt flag to clear. This parameter can be one of the following values:

    • GPT_FLAG_UPDATE: Update interrupt flag

    • GPT_FLAG_CC1: Capture/Compare 1 interrupt flag

    • GPT_FLAG_CC2: Capture/Compare 2 interrupt flag

    • GPT_FLAG_CC3: Capture/Compare 3 interrupt flag

    • GPT_FLAG_CC4: Capture/Compare 4 interrupt flag

    • GPT_FLAG_CC5: Compare 5 interrupt flag

    • GPT_FLAG_CC6: Compare 6 interrupt flag

    • GPT_FLAG_COM: Commutation interrupt flag

    • GPT_FLAG_TRIGGER: Trigger interrupt flag

    • GPT_FLAG_BREAK: Break interrupt flag

    • GPT_FLAG_BREAK2: Break 2 interrupt flag

    • GPT_FLAG_SYSTEM_BREAK: System Break interrupt flag

    • GPT_FLAG_CC1OF: Capture/Compare 1 overcapture flag

    • GPT_FLAG_CC2OF: Capture/Compare 2 overcapture flag

    • GPT_FLAG_CC3OF: Capture/Compare 3 overcapture flag

    • GPT_FLAG_CC4OF: Capture/Compare 4 overcapture flag

返回值:

The – new state of FLAG (TRUE or FALSE).

__HAL_GPT_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__)

Check whether the specified TIM interrupt source is enabled or not.

参数:
  • __HANDLE__ – TIM handle

  • __INTERRUPT__ – specifies the TIM interrupt source to check. This parameter can be one of the following values:

    • GPT_IT_UPDATE: Update interrupt

    • GPT_IT_CC1: Capture/Compare 1 interrupt

    • GPT_IT_CC2: Capture/Compare 2 interrupt

    • GPT_IT_CC3: Capture/Compare 3 interrupt

    • GPT_IT_CC4: Capture/Compare 4 interrupt

    • GPT_IT_COM: Commutation interrupt

    • GPT_IT_TRIGGER: Trigger interrupt

    • GPT_IT_BREAK: Break interrupt

返回值:

The – state of GPT_IT (SET or RESET).

__HAL_GPT_CLEAR_IT(__HANDLE__, __INTERRUPT__)

Clear the TIM interrupt pending bits.

参数:
  • __HANDLE__ – TIM handle

  • __INTERRUPT__ – specifies the interrupt pending bit to clear. This parameter can be one of the following values:

    • GPT_IT_UPDATE: Update interrupt

    • GPT_IT_CC1: Capture/Compare 1 interrupt

    • GPT_IT_CC2: Capture/Compare 2 interrupt

    • GPT_IT_CC3: Capture/Compare 3 interrupt

    • GPT_IT_CC4: Capture/Compare 4 interrupt

    • GPT_IT_COM: Commutation interrupt

    • GPT_IT_TRIGGER: Trigger interrupt

    • GPT_IT_BREAK: Break interrupt

返回值:

None

__HAL_GPT_IS_GPT_COUNTING_DOWN(__HANDLE__)

@brief  Indicates whether or not the TIM Counter is used as downcounter.
@param  \__HANDLE__ TIM handle.
@retval False (Counter used as upcounter) or True (Counter used as downcounter)
@note This macro is particularly useful to get the counting mode when the timer operates in Center-aligned mode or Encoder
mode.

__HAL_GPT_SET_PRESCALER(__HANDLE__, __PRESC__)

Set the TIM Prescaler on runtime.

参数:
  • __HANDLE__ – TIM handle.

  • __PRESC__ – specifies the Prescaler new value.

返回值:

None

__HAL_GPT_SET_MODE(__HANDLE__, __MODE__)

Set the TIM single mode.

参数:
  • __HANDLE__ – TIM handle.

  • __MODE__ – GPT_OPMODE_REPETITIVE:REPETITIVE, GPT_OPMODE_SINGLE:One pulse.

返回值:

None

GPT_SET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__, __ICPSC__)
GPT_RESET_ICPRESCALERVALUE(__HANDLE__, __CHANNEL__)
GPT_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__)
GPT_RESET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__)
__HAL_GPT_SET_COMPARE(__HANDLE__, __CHANNEL__, __COMPARE__)

Sets the TIM Capture Compare Register value on runtime without calling another time ConfigChannel function.

参数:
  • __HANDLE__ – TIM handle.

  • __CHANNEL__ – TIM Channels to be configured. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

  • __COMPARE__ – specifies the Capture Compare register new value.

返回值:

None

__HAL_GPT_GET_COMPARE(__HANDLE__, __CHANNEL__)

Gets the TIM Capture Compare Register value on runtime.

参数:
  • __HANDLE__ – TIM handle.

  • __CHANNEL__ – TIM Channel associated with the capture compare register This parameter can be one of the following values:

    • GPT_CHANNEL_1: get capture/compare 1 register value

    • GPT_CHANNEL_2: get capture/compare 2 register value

    • GPT_CHANNEL_3: get capture/compare 3 register value

    • GPT_CHANNEL_4: get capture/compare 4 register value

    • GPT_CHANNEL_5: get capture/compare 5 register value

    • GPT_CHANNEL_6: get capture/compare 6 register value

返回值:

16-bit – or 32-bit value of the capture/compare register (TIMx_CCRy)

__HAL_GPT_SET_COUNTER(__HANDLE__, __COUNTER__)

Sets the TIM Counter Register value on runtime.

参数:
  • __HANDLE__ – TIM handle.

  • __COUNTER__ – specifies the Counter register new value.

返回值:

None

__HAL_GPT_GET_COUNTER(__HANDLE__)

Gets the TIM Counter Register value on runtime.

参数:
  • __HANDLE__ – TIM handle.

返回值:

16-bit – or 32-bit value of the timer counter register (TIMx_CNT)

__HAL_GPT_SET_AUTORELOAD(__HANDLE__, __AUTORELOAD__)

Sets the TIM Autoreload Register value on runtime without calling another time any Init function.

参数:
  • __HANDLE__ – TIM handle.

  • __AUTORELOAD__ – specifies the Counter register new value.

返回值:

None

__HAL_GPT_GET_AUTORELOAD(__HANDLE__)

Gets the TIM Autoreload Register value on runtime.

参数:
  • __HANDLE__ – TIM handle.

返回值:

16-bit – or 32-bit value of the timer auto-reload register(TIMx_ARR)

__HAL_GPT_SET_ICPRESCALER(__HANDLE__, __CHANNEL__, __ICPSC__)

Sets the TIM Input Capture prescaler on runtime without calling another time HAL_GPT_IC_ConfigChannel() function.

参数:
  • __HANDLE__ – TIM handle.

  • __CHANNEL__ – TIM Channels to be configured. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

  • __ICPSC__ – specifies the Input Capture4 prescaler new value. This parameter can be one of the following values:

    • GPT_ICPSC_DIV1: no prescaler

    • GPT_ICPSC_DIV2: capture is done once every 2 events

    • GPT_ICPSC_DIV4: capture is done once every 4 events

    • GPT_ICPSC_DIV8: capture is done once every 8 events

返回值:

None

__HAL_GPT_GET_ICPRESCALER(__HANDLE__, __CHANNEL__)

Get the TIM Input Capture prescaler on runtime.

参数:
  • __HANDLE__ – TIM handle.

  • __CHANNEL__ – TIM Channels to be configured. This parameter can be one of the following values:

    • GPT_CHANNEL_1: get input capture 1 prescaler value

    • GPT_CHANNEL_2: get input capture 2 prescaler value

    • GPT_CHANNEL_3: get input capture 3 prescaler value

    • GPT_CHANNEL_4: get input capture 4 prescaler value

返回值:

The – input capture prescaler can be one of the following values:

  • GPT_ICPSC_DIV1: no prescaler

  • GPT_ICPSC_DIV2: capture is done once every 2 events

  • GPT_ICPSC_DIV4: capture is done once every 4 events

  • GPT_ICPSC_DIV8: capture is done once every 8 events

__HAL_GPT_URS_ENABLE(__HANDLE__)

Set the Update Request Source (URS) bit of the TIMx_CR1 register.

备注

When the USR bit of the TIMx_CR1 register is set, only counter overflow/underflow generates an update interrupt or DMA request (if enabled)

参数:
  • __HANDLE__ – TIM handle.

返回值:

None

__HAL_GPT_URS_DISABLE(__HANDLE__)

Reset the Update Request Source (URS) bit of the TIMx_CR1 register.

备注

When the USR bit of the TIMx_CR1 register is reset, any of the following events generate an update interrupt or DMA request (if enabled): _ Counter overflow/underflow _ Setting the UG bit _ Update generation through the slave mode controller

参数:
  • __HANDLE__ – TIM handle.

返回值:

None

__HAL_GPT_SET_CAPTUREPOLARITY(__HANDLE__, __CHANNEL__, __POLARITY__)

Sets the TIM Capture x input polarity on runtime.

备注

The polarity GPT_INPUTCHANNELPOLARITY_BOTHEDGE is not authorized for TIM Channel 4.

参数:
  • __HANDLE__ – TIM handle.

  • __CHANNEL__ – TIM Channels to be configured. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

  • __POLARITY__ – Polarity for TIx source

    • GPT_INPUTCHANNELPOLARITY_RISING: Rising Edge

    • GPT_INPUTCHANNELPOLARITY_FALLING: Falling Edge

    • GPT_INPUTCHANNELPOLARITY_BOTHEDGE: Rising and Falling Edge

返回值:

None

IS_GPT_COUNTER_MODE(MODE)
IS_GPT_PWM_MODE(MODE)
IS_GPT_OC_MODE(MODE)
IS_GPT_FAST_STATE(STATE)
IS_GPT_OC_POLARITY(POLARITY)
IS_GPT_OCN_POLARITY(POLARITY)
IS_GPT_OCIDLE_STATE(STATE)
IS_GPT_OCNIDLE_STATE(STATE)
IS_GPT_CHANNELS(CHANNEL)
IS_GPT_OPM_CHANNELS(CHANNEL)
IS_GPT_COMPLEMENTARY_CHANNELS(CHANNEL)
IS_GPT_IC_POLARITY(POLARITY)
IS_GPT_IC_SELECTION(SELECTION)
IS_GPT_IC_PRESCALER(PRESCALER)
IS_GPT_OPM_MODE(MODE)
IS_GPT_DMA_SOURCE(SOURCE)
IS_GPT_ENCODER_MODE(MODE)
IS_GPT_EVENT_SOURCE(SOURCE)
IS_GPT_CLOCKSOURCE(CLOCK)
IS_GPT_CLOCKPOLARITY(POLARITY)
IS_GPT_CLOCKPRESCALER(PRESCALER)
IS_GPT_CLOCKFILTER(ICFILTER)
IS_GPT_CLEARINPUT_SOURCE(SOURCE)
IS_GPT_CLEARINPUT_POLARITY(POLARITY)
IS_GPT_CLEARINPUT_PRESCALER(PRESCALER)
IS_GPT_CLEARINPUT_FILTER(ICFILTER)
IS_GPT_OSSR_STATE(STATE)
IS_GPT_OSSI_STATE(STATE)
IS_GPT_LOCK_LEVEL(LEVEL)
IS_GPT_BREAK_STATE(STATE)
IS_GPT_BREAK_POLARITY(POLARITY)
IS_GPT_AUTOMATIC_OUTPUT_STATE(STATE)
IS_GPT_TRGO_SOURCE(SOURCE)
IS_GPT_SLAVE_MODE(MODE)
IS_GPT_MSM_STATE(STATE)
IS_GPT_TRIGGER_SELECTION(SELECTION)
IS_GPT_INTERNAL_TRIGGEREVENT_SELECTION(SELECTION)
IS_GPT_TRIGGERPOLARITY(POLARITY)
IS_GPT_TRIGGERPRESCALER(PRESCALER)
IS_GPT_TRIGGERFILTER(ICFILTER)
IS_GPT_TI1SELECTION(TI1SELECTION)
IS_GPT_DMA_BASE(BASE)
IS_GPT_DMA_LENGTH(LENGTH)
IS_GPT_IC_FILTER(ICFILTER)
GPT_CCER_CCxE_MASK
GPT_CCER_CCxNE_MASK
GPT_CCER_CC1NE_Pos
GPT_CCER_CC1NE_Msk

0x00000004

GPT_CCER_CC1NE

Capture/Compare 1 Complementary output enable

GPT_CCER_CC2NE_Pos
GPT_CCER_CC2NE_Msk

0x00000040

GPT_CCER_CC2NE

Capture/Compare 2 Complementary output enable

GPT_CCER_CC3NE_Pos
GPT_CCER_CC3NE_Msk

0x00000400

GPT_CCER_CC3NE

Capture/Compare 3 Complementary output enable

GPT_DIER_COMIE_Pos
GPT_DIER_COMIE_Msk

0x00000020

GPT_DIER_COMIE

COM interrupt enable

GPT_DIER_BIE_Pos
GPT_DIER_BIE_Msk

0x00000080

GPT_DIER_BIE

Break interrupt enable

GPT_DIER_COMDE_Pos
GPT_DIER_COMDE_Msk

0x00002000

GPT_DIER_COMDE

COM DMA request enable

GPT_CR1_CKD_0

0x00000100

GPT_CR1_CKD_1

0x00000200

GPT_CR2_CCUS_Pos
GPT_CR2_CCUS_Msk

0x00000004

GPT_CR2_CCUS

Capture/Compare Control Update Selection

GPT_CR2_OIS1_Pos
GPT_CR2_OIS1_Msk

0x00000100

GPT_CR2_OIS1

Output Idle state 1 (OC1 output)

GPT_CR2_OIS1N_Pos
GPT_CR2_OIS1N_Msk

0x00000200

GPT_CR2_OIS1N

Output Idle state 1 (OC1N output)

GPT_CR2_OIS2_Pos
GPT_CR2_OIS2_Msk

0x00000400

GPT_CR2_OIS2

Output Idle state 2 (OC2 output)

GPT_CR2_OIS2N_Pos
GPT_CR2_OIS2N_Msk

0x00000800

GPT_CR2_OIS2N

Output Idle state 2 (OC2N output)

GPT_CR2_OIS3_Pos
GPT_CR2_OIS3_Msk

0x00001000

GPT_CR2_OIS3

Output Idle state 3 (OC3 output)

GPT_CR2_OIS3N_Pos
GPT_CR2_OIS3N_Msk

0x00002000

GPT_CR2_OIS3N

Output Idle state 3 (OC3N output)

GPT_CR2_OIS4_Pos
GPT_CR2_OIS4_Msk

0x00004000

GPT_CR2_OIS4

Output Idle state 4 (OC4 output)

GPT_SR_COMIF_Pos
GPT_SR_COMIF_Msk

0x00000020

GPT_SR_COMIF

COM interrupt Flag

GPT_SR_BIF_Pos
GPT_SR_BIF_Msk

0x00000080

GPT_SR_BIF

Break interrupt Flag

GPT_SMCR_ETPS_0

0x00001000

GPT_SMCR_ETPS_1

0x00002000

GPT_SMCR_TS_0

0x00000010

GPT_SMCR_TS_1

0x00000020

GPT_SMCR_TS_2

0x00000040

GPT_CCMR1_CC1S_0

0x00000001

GPT_CCMR1_CC1S_1

0x00000002

GPT_CCMR1_OC1M_0

0x00000010

GPT_CCMR1_OC1M_1

0x00000020

GPT_CCMR1_OC1M_2

0x00000040

IS_GPT_CC1_INSTANCE(inst)
IS_GPT_CC2_INSTANCE(inst)
IS_GPT_CC3_INSTANCE(inst)
IS_GPT_CC4_INSTANCE(__INSTANCE__)
IS_GPT_ADVANCED_INSTANCE(inst)
IS_ATIM_INSTANCE(__INSTANCE__)
IS_GPT_INSTANCE(__INSTANCE__)
IS_GPT_DMA_INSTANCE(__INSTANCE__)
IS_ATIM_DMA_INSTANCE(__INSTANCE__)
IS_ATIM_CCX_INSTANCE(INSTANCE, chn)
IS_GPT_CCX_INSTANCE(INSTANCE, chn)
IS_GPT_SLAVE_INSTANCE(__INSTANCE__)
IS_GPT_XOR_INSTANCE(__INSTANCE__)
IS_GPT_ETR_INSTANCE(__INSTANCE__)
IS_GPT_DMABURST_INSTANCE(__INSTANCE__)
IS_GPT_DMA_CC_INSTANCE(__INSTANCE__)
GPT_SMCR_SMS_0
GPT_SMCR_SMS_1
GPT_SMCR_SMS_2
IS_GPT_SLAVEMODE_TRIGGER_ENABLED(__TRIGGER__)

Enums

enum HAL_GPT_StateTypeDef

HAL State structures definition.

Values:

enumerator HAL_GPT_STATE_RESET

Peripheral not yet initialized or disabled

enumerator HAL_GPT_STATE_READY

Peripheral Initialized and ready for use

enumerator HAL_GPT_STATE_BUSY

An internal process is ongoing

enumerator HAL_GPT_STATE_TIMEOUT

Timeout state

enumerator HAL_GPT_STATE_ERROR

Reception process is ongoing

enum HAL_GPT_ActiveChannel

HAL Active channel structures definition.

Values:

enumerator HAL_GPT_ACTIVE_CHANNEL_1

The active channel is 1

enumerator HAL_GPT_ACTIVE_CHANNEL_2

The active channel is 2

enumerator HAL_GPT_ACTIVE_CHANNEL_3

The active channel is 3

enumerator HAL_GPT_ACTIVE_CHANNEL_4

The active channel is 4

enumerator HAL_GPT_ACTIVE_CHANNEL_CLEARED

All active channels cleared

enum HAL_GPT_DMABurstStateTypeDef

DMA Burst States definition.

Values:

enumerator HAL_DMA_BURST_STATE_RESET

DMA Burst initial state

enumerator HAL_DMA_BURST_STATE_READY

DMA Burst ready for use

enumerator HAL_DMA_BURST_STATE_BUSY

Ongoing DMA Burst

enum HAL_GPT_ChannelStateTypeDef

TIM Channel States definition.

Values:

enumerator HAL_GPT_CHANNEL_STATE_RESET

TIM Channel initial state

enumerator HAL_GPT_CHANNEL_STATE_READY

TIM Channel ready for use

enumerator HAL_GPT_CHANNEL_STATE_BUSY

An internal process is ongoing on the TIM channel

Functions

HAL_StatusTypeDef HAL_GPT_Base_Init(GPT_HandleTypeDef *htim)

Initializes the TIM Time base Unit according to the specified parameters in the GPT_HandleTypeDef and create the associated handle.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Base_DeInit(GPT_HandleTypeDef *htim)

DeInitializes the TIM Base peripheral.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

void HAL_GPT_Base_MspInit(GPT_HandleTypeDef *htim)

Initializes the TIM Base MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_Base_MspDeInit(GPT_HandleTypeDef *htim)

DeInitializes TIM Base MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

HAL_StatusTypeDef HAL_GPT_Base_Start(GPT_HandleTypeDef *htim)

Starts the TIM Base generation.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Base_Stop(GPT_HandleTypeDef *htim)

Stops the TIM Base generation.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Base_Start_IT(GPT_HandleTypeDef *htim)

Starts the TIM Base generation in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Base_Stop_IT(GPT_HandleTypeDef *htim)

Stops the TIM Base generation in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Base_Start_DMA(GPT_HandleTypeDef *htim, uint32_t *pData, uint16_t Length)

Starts the TIM Base generation in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • pData – The source Buffer address.

  • Length – The length of data to be transferred from memory to peripheral.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Base_Stop_DMA(GPT_HandleTypeDef *htim)

Stops the TIM Base generation in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OC_Init(GPT_HandleTypeDef *htim)

Initializes the TIM Output Compare according to the specified parameters in the GPT_HandleTypeDef and create the associated handle.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OC_DeInit(GPT_HandleTypeDef *htim)

DeInitializes the TIM peripheral.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

void HAL_GPT_OC_MspInit(GPT_HandleTypeDef *htim)

Initializes the TIM Output Compare MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_OC_MspDeInit(GPT_HandleTypeDef *htim)

DeInitializes TIM Output Compare MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

HAL_StatusTypeDef HAL_GPT_OC_Start(GPT_HandleTypeDef *htim, uint32_t Channel)

Starts the TIM Output Compare signal generation.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channel to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OC_Stop(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM Output Compare signal generation.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channel to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OC_Start_IT(GPT_HandleTypeDef *htim, uint32_t Channel)

Starts the TIM Output Compare signal generation in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channel to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OC_Stop_IT(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM Output Compare signal generation in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channel to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OC_Start_DMA(GPT_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)

Starts the TIM Output Compare signal generation in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channel to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

  • pData – The source Buffer address.

  • Length – The length of data to be transferred from memory to TIM peripheral

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OC_Stop_DMA(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM Output Compare signal generation in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channel to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_PWM_Init(GPT_HandleTypeDef *htim)

Initializes the TIM PWM Time Base according to the specified parameters in the GPT_HandleTypeDef and create the associated handle.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_PWM_DeInit(GPT_HandleTypeDef *htim)

DeInitializes the TIM peripheral.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

void HAL_GPT_PWM_MspInit(GPT_HandleTypeDef *htim)

Initializes the TIM PWM MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_PWM_MspDeInit(GPT_HandleTypeDef *htim)

DeInitializes TIM PWM MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

HAL_StatusTypeDef HAL_GPT_PWM_Start(GPT_HandleTypeDef *htim, uint32_t Channel)

Starts the PWM signal generation.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_PWM_Stop(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the PWM signal generation.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_PWM_Start_IT(GPT_HandleTypeDef *htim, uint32_t Channel)

Starts the PWM signal generation in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channel to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_PWM_Stop_IT(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the PWM signal generation in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_PWM_Start_DMA(GPT_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)

Starts the TIM PWM signal generation in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

  • pData – The source Buffer address.

  • Length – The length of data to be transferred from memory to TIM peripheral

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_PWM_Stop_DMA(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM PWM signal generation in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_IC_Init(GPT_HandleTypeDef *htim)

Initializes the TIM Input Capture Time base according to the specified parameters in the GPT_HandleTypeDef and create the associated handle.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_IC_DeInit(GPT_HandleTypeDef *htim)

DeInitializes the TIM peripheral.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

void HAL_GPT_IC_MspInit(GPT_HandleTypeDef *htim)

Initializes the TIM INput Capture MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_IC_MspDeInit(GPT_HandleTypeDef *htim)

DeInitializes TIM Input Capture MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

HAL_StatusTypeDef HAL_GPT_IC_Start(GPT_HandleTypeDef *htim, uint32_t Channel)

Starts the TIM Input Capture measurement.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_IC_Stop(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM Input Capture measurement.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_IC_Start_IT(GPT_HandleTypeDef *htim, uint32_t Channel)

Starts the TIM Input Capture measurement in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_IC_Stop_IT(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM Input Capture measurement in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_IC_Start_DMA(GPT_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData, uint16_t Length)

Starts the TIM Input Capture measurement on in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

  • pData – The destination Buffer address.

  • Length – The length of data to be transferred from TIM peripheral to memory.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_IC_Stop_DMA(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM Input Capture measurement on in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OnePulse_Init(GPT_HandleTypeDef *htim, uint32_t OnePulseMode)

Initializes the TIM One Pulse Time Base according to the specified parameters in the GPT_HandleTypeDef and create the associated handle.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • OnePulseMode – Select the One pulse mode. This parameter can be one of the following values:

    • GPT_OPMODE_SINGLE: Only one pulse will be generated.

    • GPT_OPMODE_REPETITIVE: Repetitive pulses will be generated.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OnePulse_DeInit(GPT_HandleTypeDef *htim)

DeInitializes the TIM One Pulse.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

void HAL_GPT_OnePulse_MspInit(GPT_HandleTypeDef *htim)

Initializes the TIM One Pulse MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_OnePulse_MspDeInit(GPT_HandleTypeDef *htim)

DeInitializes TIM One Pulse MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

HAL_StatusTypeDef HAL_GPT_OnePulse_Start(GPT_HandleTypeDef *htim, uint32_t OutputChannel)

Starts the TIM One Pulse signal generation.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • OutputChannel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OnePulse_Stop(GPT_HandleTypeDef *htim, uint32_t OutputChannel)

Stops the TIM One Pulse signal generation.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • OutputChannel – TIM Channels to be disable. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OnePulse_Start_IT(GPT_HandleTypeDef *htim, uint32_t OutputChannel)

Starts the TIM One Pulse signal generation in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • OutputChannel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OnePulse_Stop_IT(GPT_HandleTypeDef *htim, uint32_t OutputChannel)

Stops the TIM One Pulse signal generation in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • OutputChannel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Encoder_Init(GPT_HandleTypeDef *htim, GPT_Encoder_InitTypeDef *sConfig)

Initializes the TIM Encoder Interface and create the associated handle.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • sConfig – TIM Encoder Interface configuration structure

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Encoder_DeInit(GPT_HandleTypeDef *htim)

DeInitializes the TIM Encoder interface.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – status

void HAL_GPT_Encoder_MspInit(GPT_HandleTypeDef *htim)

Initializes the TIM Encoder Interface MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_Encoder_MspDeInit(GPT_HandleTypeDef *htim)

DeInitializes TIM Encoder Interface MSP.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

HAL_StatusTypeDef HAL_GPT_Encoder_Start(GPT_HandleTypeDef *htim, uint32_t Channel)

Starts the TIM Encoder Interface.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Encoder_Stop(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM Encoder Interface.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Encoder_Start_IT(GPT_HandleTypeDef *htim, uint32_t Channel)

Starts the TIM Encoder Interface in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Encoder_Stop_IT(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM Encoder Interface in interrupt mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be disabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Encoder_Start_DMA(GPT_HandleTypeDef *htim, uint32_t Channel, uint32_t *pData1, uint32_t *pData2, uint16_t Length)

Starts the TIM Encoder Interface in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected

  • pData1 – The destination Buffer address for IC1.

  • pData2 – The destination Buffer address for IC2.

  • Length – The length of data to be transferred from TIM peripheral to memory.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_Encoder_Stop_DMA(GPT_HandleTypeDef *htim, uint32_t Channel)

Stops the TIM Encoder Interface in DMA mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_ALL: TIM Channel 1 and TIM Channel 2 are selected

返回值:

HAL – status

void HAL_GPT_IRQHandler(GPT_HandleTypeDef *htim)

This function handles TIM interrupts requests.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

HAL_StatusTypeDef HAL_GPT_OC_ConfigChannel(GPT_HandleTypeDef *htim, GPT_OC_InitTypeDef *sConfig, uint32_t Channel)

Initializes the TIM Output Compare Channels according to the specified parameters in the GPT_OC_InitTypeDef.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • sConfig – TIM Output Compare configuration structure

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_IC_ConfigChannel(GPT_HandleTypeDef *htim, GPT_IC_InitTypeDef *sConfig, uint32_t Channel)

Initializes the TIM Input Capture Channels according to the specified parameters in the GPT_IC_InitTypeDef.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • sConfig – TIM Input Capture configuration structure

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_PWM_ConfigChannel(GPT_HandleTypeDef *htim, GPT_OC_InitTypeDef *sConfig, uint32_t Channel)

Initializes the TIM PWM channels according to the specified parameters in the GPT_OC_InitTypeDef.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • sConfig – TIM PWM configuration structure

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_OnePulse_ConfigChannel(GPT_HandleTypeDef *htim, GPT_OnePulse_InitTypeDef *sConfig, uint32_t OutputChannel, uint32_t InputChannel)

Initializes the TIM One Pulse Channels according to the specified parameters in the GPT_OnePulse_InitTypeDef.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • sConfig – TIM One Pulse configuration structure

  • OutputChannel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

  • InputChannel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_ConfigOCrefClear(GPT_HandleTypeDef *htim, GPT_ClearInputConfigTypeDef *sClearInputConfig, uint32_t Channel)

Configures the OCRef clear feature.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • sClearInputConfig – pointer to a GPT_ClearInputConfigTypeDef structure that contains the OCREF clear feature and parameters for the TIM peripheral.

  • Channel – specifies the TIM Channel. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_ConfigClockSource(GPT_HandleTypeDef *htim, GPT_ClockConfigTypeDef *sClockSourceConfig)

Configures the clock source to be used.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • sClockSourceConfig – pointer to a GPT_ClockConfigTypeDef structure that contains the clock source information for the TIM peripheral.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_ConfigTI1Input(GPT_HandleTypeDef *htim, uint32_t TI1_Selection)

Selects the signal connected to the TI1 input: direct from CH1_input or a XOR combination between CH1_input, CH2_input & CH3_input.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • TI1_Selection – Indicate whether or not channel 1 is connected to the output of a XOR gate. This parameter can be one of the following values:

    • GPT_TI1SELECTION_CH1: The TIMx_CH1 pin is connected to TI1 input

    • GPT_TI1SELECTION_XORCOMBINATION: The TIMx_CH1, CH2 and CH3 pins are connected to the TI1 input (XOR combination)

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_SlaveConfigSynchronization(GPT_HandleTypeDef *htim, GPT_SlaveConfigTypeDef *sSlaveConfig)

Configures the TIM in Slave mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • sSlaveConfig – pointer to a GPT_SlaveConfigTypeDef structure that contains the selected trigger (internal trigger input, filtered timer input or external trigger input) and the ) and the Slave mode (Disable, Reset, Gated, Trigger, External clock mode 1).

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_SlaveConfigSynchronization_IT(GPT_HandleTypeDef *htim, GPT_SlaveConfigTypeDef *sSlaveConfig)

Configures the TIM in Slave mode in interrupt mode.

参数:
  • htim – TIM handle.

  • sSlaveConfig – pointer to a GPT_SlaveConfigTypeDef structure that contains the selected trigger (internal trigger input, filtered timer input or external trigger input) and the ) and the Slave mode (Disable, Reset, Gated, Trigger, External clock mode 1).

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_DMABurst_WriteStart(GPT_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)

Configure the DMA Burst to transfer Data from the memory to the TIM peripheral.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • BurstBaseAddress – TIM Base address from when the DMA will starts the Data write. This parameters can be on of the following values:

    • GPT_DMABASE_CR1

    • GPT_DMABASE_CR2

    • GPT_DMABASE_SMCR

    • GPT_DMABASE_DIER

    • GPT_DMABASE_SR

    • GPT_DMABASE_EGR

    • GPT_DMABASE_CCMR1

    • GPT_DMABASE_CCMR2

    • GPT_DMABASE_CCER

    • GPT_DMABASE_CNT

    • GPT_DMABASE_PSC

    • GPT_DMABASE_ARR

    • GPT_DMABASE_RCR

    • GPT_DMABASE_CCR1

    • GPT_DMABASE_CCR2

    • GPT_DMABASE_CCR3

    • GPT_DMABASE_CCR4

    • GPT_DMABASE_BDTR

    • GPT_DMABASE_DCR

  • BurstRequestSrc – TIM DMA Request sources. This parameters can be on of the following values:

    • GPT_DMA_UPDATE: TIM update Interrupt source

    • GPT_DMA_CC1: TIM Capture Compare 1 DMA source

    • GPT_DMA_CC2: TIM Capture Compare 2 DMA source

    • GPT_DMA_CC3: TIM Capture Compare 3 DMA source

    • GPT_DMA_CC4: TIM Capture Compare 4 DMA source

    • GPT_DMA_COM: TIM Commutation DMA source

    • GPT_DMA_TRIGGER: TIM Trigger DMA source

  • BurstBuffer – The Buffer address.

  • BurstLength – DMA Burst length. This parameter can be one value between GPT_DMABURSTLENGTH_1TRANSFER and GPT_DMABURSTLENGTH_18TRANSFERS.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_DMABurst_WriteStop(GPT_HandleTypeDef *htim, uint32_t BurstRequestSrc)

Stops the TIM DMA Burst mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • BurstRequestSrc – TIM DMA Request sources to disable

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_DMABurst_ReadStart(GPT_HandleTypeDef *htim, uint32_t BurstBaseAddress, uint32_t BurstRequestSrc, uint32_t *BurstBuffer, uint32_t BurstLength)

Configure the DMA Burst to transfer Data from the TIM peripheral to the memory.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • BurstBaseAddress – TIM Base address from when the DMA will starts the Data read. This parameters can be on of the following values:

    • GPT_DMABASE_CR1

    • GPT_DMABASE_CR2

    • GPT_DMABASE_SMCR

    • GPT_DMABASE_DIER

    • GPT_DMABASE_SR

    • GPT_DMABASE_EGR

    • GPT_DMABASE_CCMR1

    • GPT_DMABASE_CCMR2

    • GPT_DMABASE_CCER

    • GPT_DMABASE_CNT

    • GPT_DMABASE_PSC

    • GPT_DMABASE_ARR

    • GPT_DMABASE_RCR

    • GPT_DMABASE_CCR1

    • GPT_DMABASE_CCR2

    • GPT_DMABASE_CCR3

    • GPT_DMABASE_CCR4

    • GPT_DMABASE_BDTR

    • GPT_DMABASE_DCR

  • BurstRequestSrc – TIM DMA Request sources. This parameters can be on of the following values:

    • GPT_DMA_UPDATE: TIM update Interrupt source

    • GPT_DMA_CC1: TIM Capture Compare 1 DMA source

    • GPT_DMA_CC2: TIM Capture Compare 2 DMA source

    • GPT_DMA_CC3: TIM Capture Compare 3 DMA source

    • GPT_DMA_CC4: TIM Capture Compare 4 DMA source

    • GPT_DMA_COM: TIM Commutation DMA source

    • GPT_DMA_TRIGGER: TIM Trigger DMA source

  • BurstBuffer – The Buffer address.

  • BurstLength – DMA Burst length. This parameter can be one value between GPT_DMABURSTLENGTH_1TRANSFER and GPT_DMABURSTLENGTH_18TRANSFERS.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_DMABurst_ReadStop(GPT_HandleTypeDef *htim, uint32_t BurstRequestSrc)

Stop the DMA burst reading.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • BurstRequestSrc – TIM DMA Request sources to disable.

返回值:

HAL – status

HAL_StatusTypeDef HAL_GPT_GenerateEvent(GPT_HandleTypeDef *htim, uint32_t EventSource)

Generate a software event.

备注

TIM6 and TIM7 can only generate an update event.

备注

GPT_EVENTSOURCE_COM and GPT_EVENTSOURCE_BREAK are used only with TIM1 and TIM8.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • EventSource – specifies the event source. This parameter can be one of the following values:

    • GPT_EVENTSOURCE_UPDATE: Timer update Event source

    • GPT_EVENTSOURCE_CC1: Timer Capture Compare 1 Event source

    • GPT_EVENTSOURCE_CC2: Timer Capture Compare 2 Event source

    • GPT_EVENTSOURCE_CC3: Timer Capture Compare 3 Event source

    • GPT_EVENTSOURCE_CC4: Timer Capture Compare 4 Event source

    • GPT_EVENTSOURCE_COM: Timer COM event source

    • GPT_EVENTSOURCE_TRIGGER: Timer Trigger Event source

    • GPT_EVENTSOURCE_BREAK: Timer Break event source

返回值:

HAL – status

uint32_t HAL_GPT_ReadCapturedValue(GPT_HandleTypeDef *htim, uint32_t Channel)

Read the captured value from Capture Compare unit.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

  • Channel – TIM Channels to be enabled. This parameter can be one of the following values:

    • GPT_CHANNEL_1: TIM Channel 1 selected

    • GPT_CHANNEL_2: TIM Channel 2 selected

    • GPT_CHANNEL_3: TIM Channel 3 selected

    • GPT_CHANNEL_4: TIM Channel 4 selected

返回值:

Captured – value

void HAL_GPT_PeriodElapsedCallback(GPT_HandleTypeDef *htim)

HW timer periodical timeout call back.

参数:
  • htim[in] low leverl HW timer device.

void HAL_GPT_OC_DelayElapsedCallback(GPT_HandleTypeDef *htim)

Output Compare callback in non blocking mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_IC_CaptureCallback(GPT_HandleTypeDef *htim)

Input Capture callback in non blocking mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_PWM_PulseFinishedCallback(GPT_HandleTypeDef *htim)

PWM Pulse finished callback in non blocking mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_PWM_PulseFinishedHalfCpltCallback(GPT_HandleTypeDef *htim)

PWM Pulse finished half complete callback in non-blocking mode.

参数:
  • htim – TIM handle

返回值:

None

void HAL_GPT_TriggerCallback(GPT_HandleTypeDef *htim)

Hall Trigger detection callback in non blocking mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

void HAL_GPT_ErrorCallback(GPT_HandleTypeDef *htim)

Timer error callback in non blocking mode.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

None

HAL_GPT_StateTypeDef HAL_GPT_Base_GetState(GPT_HandleTypeDef *htim)

Return the TIM Base state.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – state

HAL_GPT_StateTypeDef HAL_GPT_OC_GetState(GPT_HandleTypeDef *htim)

Return the TIM OC state.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – state

HAL_GPT_StateTypeDef HAL_GPT_PWM_GetState(GPT_HandleTypeDef *htim)

Return the TIM PWM state.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – state

HAL_GPT_StateTypeDef HAL_GPT_IC_GetState(GPT_HandleTypeDef *htim)

Return the TIM Input Capture state.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – state

HAL_GPT_StateTypeDef HAL_GPT_OnePulse_GetState(GPT_HandleTypeDef *htim)

Return the TIM One Pulse Mode state.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – state

HAL_GPT_StateTypeDef HAL_GPT_Encoder_GetState(GPT_HandleTypeDef *htim)

Return the TIM Encoder Mode state.

参数:
  • htim – pointer to a GPT_HandleTypeDef structure that contains the configuration information for TIM module.

返回值:

HAL – state

void GPT_Base_SetConfig(GPT_TypeDef *TIMx, GPT_Base_InitTypeDef *Structure)
void GPT_TI1_SetConfig(GPT_TypeDef *TIMx, uint32_t GPT_ICPolarity, uint32_t GPT_ICSelection, uint32_t GPT_ICFilter)
void GPT_OC2_SetConfig(GPT_TypeDef *TIMx, GPT_OC_InitTypeDef *OC_Config)
void GPT_DMADelayPulseCplt(DMA_HandleTypeDef *hdma)
void GPT_DMAError(DMA_HandleTypeDef *hdma)
void GPT_DMACaptureCplt(DMA_HandleTypeDef *hdma)
void GPT_DMACaptureHalfCplt(DMA_HandleTypeDef *hdma)
void GPT_CCxChannelCmd(GPT_TypeDef *TIMx, uint32_t Channel, uint32_t ChannelState)
struct GPT_Base_InitTypeDef
#include <bf0_hal_tim.h>

TIM Time base Configuration Structure definition.

Public Members

uint32_t Prescaler

Specifies the prescaler value used to divide the TIM clock. This parameter can be a number between Min_Data = 0x0000U and Max_Data = 0xFFFFU

uint32_t CounterMode

Specifies the counter mode. This parameter can be a value of TIM Counter Mode

uint32_t Period

Specifies the period value to be loaded into the active Auto-Reload Register at the next update event. This parameter can be a number between Min_Data = 0x0000U and Max_Data = 0xFFFF.

uint32_t RepetitionCounter

Specifies the repetition counter value. Each time the RCR downcounter reaches zero, an update event is generated and counting restarts from the RCR value (N). This means in PWM mode that (N+1) corresponds to:

  • the number of PWM periods in edge-aligned mode

  • the number of half PWM period in center-aligned mode This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF.

备注

This parameter is valid only for TIM1 and TIM8.

struct GPT_OC_InitTypeDef
#include <bf0_hal_tim.h>

TIM Output Compare Configuration Structure definition.

Public Members

uint32_t OCMode

Specifies the TIM mode. This parameter can be a value of TIM Output Compare and PWM modes

uint32_t Pulse

Specifies the pulse value to be loaded into the Capture Compare Register. This parameter can be a number between Min_Data = 0x0000U and Max_Data = 0xFFFFU

uint32_t OCPolarity

Specifies the output polarity. This parameter can be a value of TIM Output Compare Polarity

uint32_t OCNPolarity

Specifies the complementary output polarity. This parameter can be a value of TIM Output CompareN Polarity

备注

This parameter is valid only for TIM1 and TIM8.

uint32_t OCFastMode

Specifies the Fast mode state. This parameter can be a value of TIM Output Fast State

备注

This parameter is valid only in PWM1 and PWM2 mode.

uint32_t OCIdleState

Specifies the TIM Output Compare pin state during Idle state. This parameter can be a value of TIM Output Compare Idle State

备注

This parameter is valid only for TIM1 and TIM8.

uint32_t OCNIdleState

Specifies the TIM Output Compare pin state during Idle state. This parameter can be a value of TIM Output Compare N Idle State

备注

This parameter is valid only for TIM1 and TIM8.

struct GPT_OnePulse_InitTypeDef
#include <bf0_hal_tim.h>

TIM One Pulse Mode Configuration Structure definition.

Public Members

uint32_t OCMode

Specifies the TIM mode. This parameter can be a value of TIM Output Compare and PWM modes

uint32_t Pulse

Specifies the pulse value to be loaded into the Capture Compare Register. This parameter can be a number between Min_Data = 0x0000U and Max_Data = 0xFFFFU

uint32_t OCPolarity

Specifies the output polarity. This parameter can be a value of TIM Output Compare Polarity

uint32_t OCNPolarity

Specifies the complementary output polarity. This parameter can be a value of TIM Output CompareN Polarity

备注

This parameter is valid only for TIM1 and TIM8.

uint32_t OCIdleState

Specifies the TIM Output Compare pin state during Idle state. This parameter can be a value of TIM Output Compare Idle State

备注

This parameter is valid only for TIM1 and TIM8.

uint32_t OCNIdleState

Specifies the TIM Output Compare pin state during Idle state. This parameter can be a value of TIM Output Compare N Idle State

备注

This parameter is valid only for TIM1 and TIM8.

uint32_t ICPolarity

Specifies the active edge of the input signal. This parameter can be a value of TIM Input Capture Polarity

uint32_t ICSelection

Specifies the input. This parameter can be a value of TIM Input Capture Selection

uint32_t ICFilter

Specifies the input capture filter. This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF

struct GPT_IC_InitTypeDef
#include <bf0_hal_tim.h>

TIM Input Capture Configuration Structure definition.

Public Members

uint32_t ICPolarity

Specifies the active edge of the input signal. This parameter can be a value of TIM Input Capture Polarity

uint32_t ICSelection

Specifies the input. This parameter can be a value of TIM Input Capture Selection

uint32_t ICPrescaler

Specifies the Input Capture Prescaler. This parameter can be a value of TIM Input Capture Prescaler

uint32_t ICFilter

Specifies the input capture filter. This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF

struct GPT_Encoder_InitTypeDef
#include <bf0_hal_tim.h>

TIM Encoder Configuration Structure definition.

Public Members

uint32_t EncoderMode

Specifies the active edge of the input signal. This parameter can be a value of TIM Encoder Mode

uint32_t IC1Polarity

Specifies the active edge of the input signal. This parameter can be a value of TIM Input Capture Polarity

uint32_t IC1Selection

Specifies the input. This parameter can be a value of TIM Input Capture Selection

uint32_t IC1Prescaler

Specifies the Input Capture Prescaler. This parameter can be a value of TIM Input Capture Prescaler

uint32_t IC1Filter

Specifies the input capture filter. This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF

uint32_t IC2Polarity

Specifies the active edge of the input signal. This parameter can be a value of TIM Input Capture Polarity

uint32_t IC2Selection

Specifies the input. This parameter can be a value of TIM Input Capture Selection

uint32_t IC2Prescaler

Specifies the Input Capture Prescaler. This parameter can be a value of TIM Input Capture Prescaler

uint32_t IC2Filter

Specifies the input capture filter. This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF

struct GPT_ClockConfigTypeDef
#include <bf0_hal_tim.h>

Clock Configuration Handle Structure definition.

Public Members

uint32_t ClockSource

TIM clock sources. This parameter can be a value of TIM Clock Source

uint32_t ClockPolarity

TIM clock polarity. This parameter can be a value of TIM Clock Polarity

uint32_t ClockPrescaler

TIM clock prescaler. This parameter can be a value of TIM Clock Prescaler

uint32_t ClockFilter

TIM clock filter. This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF

struct GPT_ClearInputConfigTypeDef
#include <bf0_hal_tim.h>

Clear Input Configuration Handle Structure definition.

Public Members

uint32_t ClearInputState

TIM clear Input state. This parameter can be ENABLE or DISABLE

uint32_t ClearInputSource

TIM clear Input sources. This parameter can be a value of TIM Clear Input Source

uint32_t ClearInputPolarity

TIM Clear Input polarity. This parameter can be a value of TIM Clear Input Polarity

uint32_t ClearInputPrescaler

TIM Clear Input prescaler. This parameter can be a value of TIM Clear Input Prescaler

uint32_t ClearInputFilter

TIM Clear Input filter. This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF

struct GPT_SlaveConfigTypeDef
#include <bf0_hal_tim.h>

TIM Slave configuration Structure definition.

Public Members

uint32_t SlaveMode

Slave mode selection This parameter can be a value of TIM Slave Mode

uint32_t InputTrigger

Input Trigger source This parameter can be a value of TIM Trigger Selection

uint32_t TriggerPolarity

Input Trigger polarity This parameter can be a value of TIM Trigger Polarity

uint32_t TriggerPrescaler

Input trigger prescaler This parameter can be a value of TIM Trigger Prescaler

uint32_t TriggerFilter

Input trigger filter This parameter can be a number between Min_Data = 0x0 and Max_Data = 0xF

struct GPT_HandleTypeDef
#include <bf0_hal_tim.h>

TIM Time Base Handle Structure definition.

Public Members

GPT_TypeDef *Instance

Register base address

GPT_Base_InitTypeDef Init

TIM Time Base required parameters

HAL_GPT_ActiveChannel Channel

Active channel

DMA_HandleTypeDef *hdma[7]

DMA Handlers array This array is accessed by a DMA Handle index

HAL_LockTypeDef Lock

Locking object

uint8_t core

Clock source from which core

HAL_GPT_StateTypeDef State

TIM operation state