void grayEventGetChange(GRAY_EVENT *event) { uint32 enc; uint32 counters = 0; uint32 time; counters = grayEventGetCounters(); time = TCTimeGet(); grayEvents++; for (enc = 0; enc < GRAY_ENC_ITEMS; enc++) { if (counters & 0xff) { event->change[enc] = (counters & 0x80) ? -1 - (0xff - (counters & 0xff)) : (counters & 0xff); event->timeDiff = TCTimeDifference(time, grayEventSetup.lastEventTime[enc]); grayEventSetup.lastEventTime[enc] = time; grayEvent[enc]++; // cliPrintf("grayEventGetChange: enc: %i, counters: 0x%08x, change:%i timeDiff:%i\n\r", enc, counters, event->change[enc], event->timeDiff); } counters >>= 8; if (counters == 0) break; } }
void sysPrintTimeDifference(uint32 endtime, uint32 starttime) { sysPrintTime(TCTimeDifference(endtime, starttime)); }