The demodulator may be used on PWM streams representing either analog or
digital data. While the PWM pulses per se have no notion of representing digital or
analog data, there are subtle differences in the way the samples are processed. In
the application note, this is controlled using a C preprocessor symbol
(ICP_ANALOG
).
icp_rx()
.icp_rx()
does not 'consume' queue elements, so the queue
never empties; two calls within a single PWM period will return the same
value.icp_rx()
always returns the oldest queued item.icp_rx()
'consumes' a queue element. If the
queue is empty, an 'idle' indicator (100% duty cycle) is returned.These are the only differences between the two schemes. Some applications, which use PWM for analog data might yet prefer that data be handled according to the rules for 'digital' data (the reverse however may not be possible).