StopWatch_Start on LPC15xx returns uint32_t?

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by 1234567890 on Mon Nov 03 14:10:01 MST 2014

nice to see a delay function in LPCOpen. But after tracing back StopWatch_DelayUS() there is something I don't understand: StopWatch_Start() reads the current RIT counter value via Chip_RIT_GetCounter(), which correctly returns a uint64_t (because RIT has 48 bits).
But in StopWatch_Start() this value is casted 'down' to uint32_t.
Doesn't this lead to wrong delays when the counter value of RIT is > uint32_t?

Ok, so just the lower 32 bits are used which limits the maximum delay time. Bits roll over from right to left. But then it's not neccessary to read the upper part of RIT.