Skip to content

Commit f3e7497

Browse files
author
Cruz Monrreal
authored
Merge pull request #7225 from bcostm/fix_hal_tick_comment
STM32: Add comments for HAL_InitTick function
2 parents 015d8f2 + 09b8b53 commit f3e7497

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

targets/TARGET_STM/hal_tick_16b.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ void timer_irq_handler(void)
3434

3535
#if defined(TARGET_STM32F0)
3636
} // end timer_update_irq_handler function
37-
// Used for mbed timeout (channel 1) and HAL tick (channel 2)
37+
38+
// Channel 1 used for mbed timeout
3839
void timer_oc_irq_handler(void)
3940
{
4041
TimMasterHandle.Instance = TIM_MST;
@@ -49,7 +50,12 @@ void timer_oc_irq_handler(void)
4950
}
5051
}
5152

52-
// Reconfigure the HAL tick using a standard timer instead of systick.
53+
// Overwrite the default ST HAL function (defined as "weak") in order to configure an HW timer
54+
// used for mbed timeouts only (not used for the Systick configuration).
55+
// Additional notes:
56+
// - The default ST HAL_InitTick function initializes the Systick to 1 ms and this is not correct for mbed
57+
// as the mbed Systick as to be configured to 1 us instead.
58+
// - Furthermore the Systick is configured by mbed RTOS directly.
5359
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
5460
{
5561
// Enable timer clock

targets/TARGET_STM/hal_tick_32b.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ void timer_irq_handler(void)
3535
}
3636
}
3737

38-
// Reconfigure the HAL tick using a standard timer instead of systick.
38+
// Overwrite the default ST HAL function (defined as "weak") in order to configure an HW timer
39+
// used for mbed timeouts only (not used for the Systick configuration).
40+
// Additional notes:
41+
// - The default ST HAL_InitTick function initializes the Systick to 1 ms and this is not correct for mbed
42+
// as the mbed Systick as to be configured to 1 us instead.
43+
// - Furthermore the Systick is configured by mbed RTOS directly.
3944
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
4045
{
4146
RCC_ClkInitTypeDef RCC_ClkInitStruct;

0 commit comments

Comments
 (0)