- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I would like to know is there a function that can be called to start a timer, leave some part of the software run away and when it is finished print the value of the timer showing how long it too to execute some part of the software?
I am used to calling them timers from my experience with stm32. Could someone help me?
Thanks,
Luke.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is probably a better way to do this, but this might work:
use rtc clock to grab the time before and after your function call and subtract the results.
the output of the clock is a 48 bit counter that runs at 128KHz.
#include "rtc.h"
rtc_init();
tRTC_REAL_TIME_CLOCK raw_clock;
// rtc clock rate is 128KHz so divide by 128 if you want milliseconds.
rtc_getRTCRawClock(&raw_clock);
raw_clock.rtc64 = raw_clock.rtc64 >> 7;