mirror of https://github.com/ARMmbed/mbed-os.git
stm32 ticker: rename macro and update ST HAL Tick functions
- rename TIM_MST_16BIT in TIM_MST_BIT_WIDTH in order to use it directly in ticker info structure - change HAL_InitTick() and HAL_GetTick()pull/7290/head
parent
b1bbd765b7
commit
fbd7a97e19
|
@ -52,7 +52,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM1_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM1_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM1_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM1_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ extern "C" {
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ extern "C" {
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM1_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM1_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM4_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM4_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM4_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM4_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM4_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM4_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ extern "C" {
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM21_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM21_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM21_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM21_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM21_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM21_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM21_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM21_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM21_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM21_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM21_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM21_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 2 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM4_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM4_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 1 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM2_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM2_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
#define TIM_MST_RESET_ON __HAL_RCC_TIM5_FORCE_RESET()
|
||||
#define TIM_MST_RESET_OFF __HAL_RCC_TIM5_RELEASE_RESET()
|
||||
|
||||
#define TIM_MST_16BIT 0 // 1=16-bit timer, 0=32-bit timer
|
||||
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
|
||||
|
||||
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
|
||||
|
||||
|
|
|
@ -14,45 +14,18 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
#include "hal/us_ticker_api.h"
|
||||
#include "hal_tick.h"
|
||||
|
||||
// Overwrite default HAL functions defined as "weak"
|
||||
|
||||
// This variable is set to 1 at the of mbed_sdk_init function.
|
||||
// The ticker_read_us function must not be called until the mbed_sdk_init is terminated.
|
||||
extern int mbed_sdk_inited;
|
||||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
|
||||
{
|
||||
us_ticker_init();
|
||||
return HAL_OK;
|
||||
}
|
||||
|
||||
#if TIM_MST_16BIT
|
||||
// Variables also reset in HAL_InitTick()
|
||||
uint32_t prev_time = 0;
|
||||
uint32_t elapsed_time = 0;
|
||||
#endif
|
||||
|
||||
// 1 ms tick is required for ST HAL driver
|
||||
uint32_t HAL_GetTick()
|
||||
{
|
||||
#if TIM_MST_16BIT
|
||||
uint32_t new_time;
|
||||
if (mbed_sdk_inited) {
|
||||
// Apply the latest time recorded just before the sdk is inited
|
||||
new_time = ticker_read_us(get_us_ticker_data()) + prev_time;
|
||||
prev_time = 0; // Use this time only once
|
||||
return (new_time / 1000);
|
||||
}
|
||||
else {
|
||||
new_time = us_ticker_read();
|
||||
elapsed_time += (new_time - prev_time) & 0xFFFF; // Only use the lower 16 bits
|
||||
prev_time = new_time;
|
||||
return (elapsed_time / 1000);
|
||||
}
|
||||
#else // 32-bit timer
|
||||
if (mbed_sdk_inited) {
|
||||
return (ticker_read_us(get_us_ticker_data()) / 1000);
|
||||
}
|
||||
else {
|
||||
return (us_ticker_read() / 1000);
|
||||
}
|
||||
#endif
|
||||
return ticker_read_us(get_us_ticker_data()) / 1000; // 1 ms tick is required for ST HAL_Delay function
|
||||
}
|
||||
|
||||
void HAL_SuspendTick(void)
|
||||
|
|
|
@ -18,34 +18,25 @@
|
|||
#include "PeripheralNames.h"
|
||||
#include "hal_tick.h"
|
||||
|
||||
// ************************************ 16-bit timer ************************************
|
||||
#if TIM_MST_16BIT
|
||||
#define TIMER_TICKER_BIT_WIDTH 16
|
||||
// ************************************ 32-bit timer ************************************
|
||||
#else
|
||||
#define TIMER_TICKER_BIT_WIDTH 32
|
||||
#endif
|
||||
|
||||
TIM_HandleTypeDef TimMasterHandle;
|
||||
|
||||
const ticker_info_t *us_ticker_get_info()
|
||||
{
|
||||
static const ticker_info_t info = {
|
||||
1000000,
|
||||
TIMER_TICKER_BIT_WIDTH
|
||||
TIM_MST_BIT_WIDTH
|
||||
};
|
||||
return &info;
|
||||
}
|
||||
|
||||
volatile uint32_t PreviousVal = 0;
|
||||
|
||||
void us_ticker_irq_handler(void);
|
||||
|
||||
// ************************************ 16-bit timer ************************************
|
||||
#if TIM_MST_16BIT
|
||||
#if TIM_MST_BIT_WIDTH == 16
|
||||
|
||||
#if defined(TARGET_STM32F0)
|
||||
void timer_update_irq_handler(void) {
|
||||
void timer_update_irq_handler(void)
|
||||
{
|
||||
#else
|
||||
void timer_irq_handler(void)
|
||||
{
|
||||
|
@ -55,13 +46,10 @@ void timer_irq_handler(void)
|
|||
#if defined(TARGET_STM32F0)
|
||||
} // end timer_update_irq_handler function
|
||||
|
||||
// Channel 1 used for mbed timeout
|
||||
void timer_oc_irq_handler(void)
|
||||
{
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
#endif
|
||||
|
||||
// Channel 1 for mbed timeout
|
||||
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) {
|
||||
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
||||
|
@ -75,7 +63,7 @@ void timer_oc_irq_handler(void)
|
|||
|
||||
void timer_irq_handler(void)
|
||||
{
|
||||
// Channel 1 for mbed timeout
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC1) == SET) {
|
||||
if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC1) == SET) {
|
||||
__HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC1);
|
||||
|
@ -90,7 +78,7 @@ void us_ticker_init(void)
|
|||
{
|
||||
|
||||
// ************************************ 16-bit timer ************************************
|
||||
#if TIM_MST_16BIT
|
||||
#if TIM_MST_BIT_WIDTH == 16
|
||||
// Enable timer clock
|
||||
TIM_MST_RCC;
|
||||
|
||||
|
@ -102,7 +90,7 @@ void us_ticker_init(void)
|
|||
SystemCoreClockUpdate();
|
||||
|
||||
// Configure time base
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
TimMasterHandle.Instance = TIM_MST;
|
||||
TimMasterHandle.Init.Period = 0xFFFF;
|
||||
TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 us tick
|
||||
TimMasterHandle.Init.ClockDivision = 0;
|
||||
|
@ -230,11 +218,9 @@ void us_ticker_fire_interrupt(void)
|
|||
{
|
||||
__HAL_TIM_CLEAR_FLAG(&TimMasterHandle, TIM_FLAG_CC1);
|
||||
LL_TIM_GenerateEvent_CC1(TimMasterHandle.Instance);
|
||||
// Enable IT
|
||||
__HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1);
|
||||
}
|
||||
|
||||
/* NOTE: must be called with interrupts disabled! */
|
||||
void us_ticker_disable_interrupt(void)
|
||||
{
|
||||
__HAL_TIM_DISABLE_IT(&TimMasterHandle, TIM_IT_CC1);
|
||||
|
|
Loading…
Reference in New Issue