4 releases
0.1.3 | May 29, 2020 |
---|---|
0.1.2 | May 22, 2020 |
0.1.1 | May 22, 2020 |
0.1.0 | May 21, 2020 |
#1430 in Embedded development
17KB
199 lines
ppm_decode
PPM decoding for no_std rust. This library decodes the commonly-used PPM format used in radio control and other embedded applications.
Example
Typically PPM pulse input might be received via an input pin interrupt. The important thing is that you provide this parser with the time of the start of a pulse. In PPM the only time difference that matters is the difference between consecutive pulses.
See PpmParser
documentation for example usage,
or refer to the
test_ppm_decode
project for an example using an stm32f4 microcontroller.
Status
- Basic parsing of anonymous PPM time events
- Basic tests
- Usage example
- Test clock overflow
- Test unusual configuration limits
- Locks onto a consistent number of channels over time
- Doc comments and example
- CI
lib.rs
:
This library provides decoding of PPM pulse edges into PPM frames. It does not require a particular interrupt handling or input pin measurement strategy. All the user needs to provide is the relative timing of pulses, and the library will extract PPM frames from that.
PPM channel values are encoded as the gap between multiple pulses. Typically PPM pulses are high values and the gaps between them are low values; however, some PPM receivers invert the signal, where the PPM signal is pulled high and pulses are low values. PPM frames consist of multiple channels encoded in this way, with a longer duration gap between the last channel and the first channel, after which comes the next frame. This frame-separating gap is referred to as a frame sync or reset. So a PPM frame with five channels might look like:
||||||___ Where high values are the pulses and low values are the gaps between pulses. The pulse duration itself is typically tuned to be as short as possible and still reliably transmitted.
The library provides defaults for common configuration values such as:
- Minimum PPM channel value (the minimum gap between pulses)
- Maximum PPM channel value (the maximum gap between pulses)
- Minimum frame sync duration (the minimum time for a gap between pulses to be considered a frame sync / reset)
- Minimum number of PPM channels to be considered a valid frame.