I am working on little endian 32bit micro-controller with no FPU. I need a way to convert a 100MHz counter to be proper milliseconds.
I want to create a function that will return me the current time in millisecond.
static uint32_t prev_time;
static uint32_t time;
uint32_t get_current_time()
{
curr_time = get_100MHz_counter_value();
uint32_t elapsed_time = curr_time - prev_time;
prev_time = curr_time;
time = /* DONT KNOW HOW TO CONVERT THE TIME USING FIXED POINT MATH */
return time;
}