Timestamp argument for edge event callback function
A Python module to control the GPIO on a Raspberry Pi
Brought to you by:
croston
I am new to signal processing / programming with the GPIO pins, so I apologize if this is a braindead suggestion.
I was playing around with a project, rpi-rf, that uses the elapsed time between GPIO edge event callbacks in order to decode a signal received by an RF module. At each callback, their code calls into the time
module to get a high precision timestamp, but I suspect that this measurement isn't too accurate (considering thread scheduling, context switches, the interpreter lock, etc.).
How about collecting the timestamp at the time that the event is generated, and passing this through to the callback?
I prototyped this and saved about 1000ns by computing the timestamp (with
clock_gettime
) in C before dispatching the event to Python.