This code is kind of messy, but it is more accurate.
Noise between time syncs seems to be around 50 nanoseconds. Noise on
external event readings seems to be around 500 nanoseconds. External
events were tested by manually inserting pins.
The mbeds seems to be consistency apart on external events, so some of
the noise could be caused by differing thresholds on the wires. Rising
edge mode on mbed seems to be ahead, and in falling edge the other is
ahead.
A large portion of the measurement errors was caused by not properly
learning pending DMA requests before enabling the DMA channels. The
pending requests seem to need to be disabled in the DMAMUX as well as
the DMA controller, and on the pins as well. It's not clearly what the
idea reset method is.