diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-02-14 19:04:17 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-02-14 19:04:17 +0100 |
commit | 541b0f27054f27e661a71aa465e2df6e5a1c0b86 (patch) | |
tree | f700dea426377894c87aa65038fbfc179a27048e /src/fecmodem.h | |
parent | c751cceda9fc6026be2ec520886624f63823c4cc (diff) |
update modem/fecmodem documentation
Diffstat (limited to 'src/fecmodem.h')
-rw-r--r-- | src/fecmodem.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/fecmodem.h b/src/fecmodem.h index 00487ee..c9a942b 100644 --- a/src/fecmodem.h +++ b/src/fecmodem.h @@ -7,6 +7,12 @@ #include "hamming.h" #include "modem.h" +/** + * Receive-only modem with forward error correction. + * Uses the Modem class to read raw modem data and uses the Hamming 2416 + * algorithm to detect and, if possible, correct transmission errors. + * Exposes a global modem object for convenience. + */ class FECModem : public Modem { private: enum HammingState : uint8_t { @@ -22,7 +28,21 @@ class FECModem : public Modem { uint8_t hamming2416(uint8_t *byte1, uint8_t *byte2, uint8_t parity); public: FECModem() : Modem() { hammingState = FIRST_BYTE; }; + + /** + * Checks if there are unprocessed bytes in the receive buffer. + * Parity bytes are accounted for, so if three raw bytes (two data, + * one parity) were received by Modem::receive(), this function will + * return 2. + * @return number of unprocessed data bytes + */ uint8_t buffer_available(void); + + /** + * Get next byte from the receive buffer. + * @return received byte (0 if it contained uncorrectable errors + * or the buffer is empty) + */ uint8_t buffer_get(void); }; |