Added rest flags function, tidied dead code & tabs
Made some changes for MISRA
made error constants signed
Made ISR static again, added struct member documentation
Made errror constants signed