https://www.google.com/search?&q=interr ... oforum.com
This thread looks promising:
https://stm32duinoforum.com/forum/viewt ... _2673.html
I suggest you refer to AN4776 Application Note
The original documentation on timers is here: http://docs.leaflabs.com/docs.leaflabs.com/index.html
Update interrupt of timer when overflow
-
- Posts: 633
- Joined: Thu Dec 19, 2019 1:23 am
Re: Update interrupt of timer when overflow
Read this: http://docs.leaflabs.com/static.leaflab ... timer.html
This documentation is valid for Roger's Core, which is based on LeafLabs core.
There is an example in the documentation:
timer.setCompare(TIMER_CH1, 1); // Interrupt 1 count after each update
TIMER UPDATE event is what you are looking for.
This documentation is valid for Roger's Core, which is based on LeafLabs core.
There is an example in the documentation:
Code: Select all
#define LED_RATE 500000 // in microseconds; should give 0.5Hz toggles
// We'll use timer 2
HardwareTimer timer(2);
void setup() {
// Set up the LED to blink
pinMode(BOARD_LED_PIN, OUTPUT);
// Pause the timer while we're configuring it
timer.pause();
// Set up period
timer.setPeriod(LED_RATE); // in microseconds
// Set up an interrupt on channel 1
timer.setChannel1Mode(TIMER_OUTPUT_COMPARE);
timer.setCompare(TIMER_CH1, 1); // Interrupt 1 count after each update
timer.attachCompare1Interrupt(handler_led);
// Refresh the timer's count, prescale, and overflow
timer.refresh();
// Start the timer counting
timer.resume();
}
void loop() {
// Nothing! It's all in the handler_led() interrupt:
}
void handler_led(void) {
toggleLED();
}
TIMER UPDATE event is what you are looking for.