It may look strangely constructed, because I was aiming for excellent compliance to timing parameters. That meant putting a timestamp on all bus activity (to enforce P3min, P4min) as well as all incoming bytes (P1max, P2...). It also did firmware-level handling of periodic messages - the idea was to keep all timing-sensitive stuff on the firmware side.
Nice to see you guys have made lots of progress over the years.
FYI I had started work on an opensource J2534 interface a few years ago and never finished it. The code for K-line was almost complete, maybe it can be useful for reference ? https://github.com/fenugrec/oj2534-fw/blob/master/src/iso_tx.c
It may look strangely constructed, because I was aiming for excellent compliance to timing parameters. That meant putting a timestamp on all bus activity (to enforce P3min, P4min) as well as all incoming bytes (P1max, P2...). It also did firmware-level handling of periodic messages - the idea was to keep all timing-sensitive stuff on the firmware side.