STM32 and Arduino Hardware Timer: TIMER_CH1 unknown

Hi,
I am trying to set up a timer on my STM32F103 Blue Pill with Arduino framework

My platformio.ini:
[env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = arduino
upload_protocol = stlink

Having a problem here:
Timer1.setCompare(TIMER_CH1, 1);

The compiler shows an error, TIMER_CH1 is not defined.

What could I have missed? I have included HardwareTimer.h
Have also tried several other code examples with the HardwareTimer instance, but none of them I was able to compile.

And how can the interrupt priority changed with NVIC_SetPriority()?

Does not appear in the STM32 core (Repository search results · GitHub), but appears in the Maple core (Repository search results · GitHub). If your intention is to develop for the Maple core, see docs.

1 Like

Thanks a lot for your hint. Where can I find the functions in STM32core to set the timers?

See the Wiki that is linked in their repo: HardwareTimer library · stm32duino/wiki Wiki · GitHub. I think the function you’re looking for is

void setCaptureCompare(uint32_t channel, uint32_t compare, TimerCompareFormat_t format = TICK_COMPARE_FORMAT);  // set Compare register value of specified channel depending on format provided
1 Like