Skip to content

Commit 08a7fd6

Browse files
committed
STM32G0: no TIM2 for G070xx
1 parent 4c29451 commit 08a7fd6

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

targets/TARGET_STM/TARGET_STM32G0/us_ticker_data.h

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
* SPDX-License-Identifier: BSD-3-Clause
33
******************************************************************************
44
*
5-
* Copyright (c) 2017 STMicroelectronics.
5+
* Copyright (c) 2017 STMicroelectronics.
66
* All rights reserved.
77
*
88
* This software component is licensed by ST under BSD 3-Clause license,
9-
* the "License"; You may not use this file except in compliance with the
9+
* the "License"; You may not use this file except in compliance with the
1010
* License. You may obtain a copy of the License at:
1111
* opensource.org/licenses/BSD-3-Clause
1212
*
@@ -16,13 +16,15 @@
1616
#define __US_TICKER_DATA_H
1717

1818
#ifdef __cplusplus
19-
extern "C" {
19+
extern "C" {
2020
#endif
2121

2222
#include "stm32g0xx.h"
2323
#include "stm32g0xx_ll_tim.h"
2424
#include "cmsis_nvic.h"
25-
25+
26+
#if defined TIM2_BASE
27+
2628
#define TIM_MST TIM2
2729
#define TIM_MST_IRQ TIM2_IRQn
2830
#define TIM_MST_RCC __TIM2_CLK_ENABLE()
@@ -33,12 +35,24 @@
3335

3436
#define TIM_MST_BIT_WIDTH 32 // 16 or 32
3537

36-
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
38+
#else // TIM2_BASE
39+
40+
#define TIM_MST TIM3
41+
#define TIM_MST_IRQ TIM3_IRQn
42+
#define TIM_MST_RCC __TIM3_CLK_ENABLE()
43+
#define TIM_MST_DBGMCU_FREEZE __HAL_DBGMCU_FREEZE_TIM3()
44+
45+
#define TIM_MST_RESET_ON __TIM3_FORCE_RESET()
46+
#define TIM_MST_RESET_OFF __TIM3_RELEASE_RESET()
3747

48+
#define TIM_MST_BIT_WIDTH 16 // 16 or 32
49+
50+
#endif // TIM2_BASE
51+
52+
#define TIM_MST_PCLK 1 // Select the peripheral clock number (1 or 2)
3853

3954
#ifdef __cplusplus
4055
}
4156
#endif
4257

4358
#endif // __US_TICKER_DATA_H
44-

0 commit comments

Comments
 (0)