Access to DWT timer?

Hi,

I tried using the DWT timer but ARM_CM_DWT_CTRL @ 0xE0001000 appears to be unavailable. Is this because it is reserved for system timing?

If so, would it be possible to get a lighter weight version of playdate->system->getElapsedTime() that returns straight ticks instead of doing float math to seconds?

Thanks,

Dave

According to my notes @Marc said May 2021:

In Lua we've got playdate.getElapsedTime() and playdate.resetElapsedTime() which allow for measurement with microsecond accuracy via the DWT Cycle Counter. It looks like we don't have it exposed in the C API at the moment, but can probably fix that for 1.1 as well!

But given your request and playdate.getElapsedTime (high resolution timer) only accurate to milliseconds (Lua) it looks like something may have gone awry.

Thanks Matt, that answers my first question - sounds like the DWT timer is reserved for system use.

So aside from fixing the order of magnitude precision issue in the C API getElapsedTime(), I'd also like a version that just returns the raw ticks or (less ideal) microseconds rather than a float seconds value.