Skip to content

Commit fc9bd4c

Browse files
committed
Merge pull request #1858 from BartSX/f103
[NUCLEO_F103RB] Revert and update path for 16-bit timer
2 parents 88fbfac + f2c824c commit fc9bd4c

File tree

2 files changed

+5
-5
lines changed
  • hal/targets/cmsis/TARGET_STM/TARGET_STM32F1

2 files changed

+5
-5
lines changed

hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/hal_tick.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ void set_compare(uint16_t count);
4343
extern volatile uint32_t SlaveCounter;
4444
extern volatile uint32_t oc_int_part;
4545
extern volatile uint16_t oc_rem_part;
46-
extern volatile uint16_t cnt_val;
4746

4847
void timer_irq_handler(void) {
49-
cnt_val= TIM_MST->CNT;
48+
uint16_t cval = TIM_MST->CNT;
5049

5150
TimMasterHandle.Instance = TIM_MST;
5251

@@ -65,7 +64,7 @@ void timer_irq_handler(void) {
6564
} else {
6665
if (oc_int_part > 0) {
6766
set_compare(0xFFFF);
68-
oc_rem_part = cnt_val; // To finish the counter loop the next time
67+
oc_rem_part = cval; // To finish the counter loop the next time
6968
oc_int_part--;
7069
} else {
7170
us_ticker_irq_handler();

hal/targets/cmsis/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/hal_tick.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ void set_compare(uint16_t count);
4343
extern volatile uint32_t SlaveCounter;
4444
extern volatile uint32_t oc_int_part;
4545
extern volatile uint16_t oc_rem_part;
46+
extern volatile uint16_t cnt_val;
4647

4748
void timer_irq_handler(void) {
48-
uint16_t cval = TIM_MST->CNT;
49+
cnt_val = TIM_MST->CNT;
4950

5051
TimMasterHandle.Instance = TIM_MST;
5152

@@ -64,7 +65,7 @@ void timer_irq_handler(void) {
6465
} else {
6566
if (oc_int_part > 0) {
6667
set_compare(0xFFFF);
67-
oc_rem_part = cval; // To finish the counter loop the next time
68+
oc_rem_part = cnt_val; // To finish the counter loop the next time
6869
oc_int_part--;
6970
} else {
7071
us_ticker_irq_handler();

0 commit comments

Comments
 (0)