Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A micros() function
16-11-2012, 01:38 AM,
#1
A micros() function
I just got my Pinguino 32 Micro and the first thing I missed was a micros() function.

So I made my own, feel free to include it, I just put it in millis.c with no other modifications. It's not the fastest with all the mulling and diving going on but better than nothing.
Code:
u32 micros()
{
    #ifdef PIC32_PINGUINO_220
        // I don't have a 220 so I can't test if this actually works
        return 1000*_millis + (1000*(65535-TMR2))/_tmr2;
    #else
        return 1000*_millis + (1000*TMR2)/PR2;
    #endif
}
Reply
16-11-2012, 08:07 AM,
#2
RE: A micros() function
Hi

Thanks, very useful.


Bye Bye, Moreno
Reply
18-11-2012, 07:30 PM,
#3
RE: A micros() function
I've added this function to the repository with a note that it has not been tested on a 220.
Can anyone confirm that it works on a 220?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)