A struct that allows to detect IR pulses and signals by polling the state
of an IR sensor periodically, calculating pulse lengths and decoding pulse
sequences into signals.
The different types of pulses. These refer only to the “on” pulse,
the “off” pulses are always the same duration. The main pulse types
are “Short” and “Long” (around 500µs and 1500µs), which are used to
transmit binary encoded button IDs.
Given a pin to read on and a handler for signal, this function
polls the pin to receive IR pulses which are decoded into signals
and then passed to the handler, when they occurr. This is running
in a dedicated thread.