cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Bluetooth

Anonymous
Not applicable

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. 

0 Likes
1 Reply
Anonymous
Not applicable

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;