diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-02-05 17:33:02 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-02-05 17:33:02 +0100 |
commit | f88c1fde18146fd1bf543399da0f6584c3fd4a81 (patch) | |
tree | d93b2d30ac2b83cc739e1ee550179c1792b1e37e /src/fecmodem.h | |
parent | 4bf560b6f3ef6089af04dfc56d078b9978496b07 (diff) |
add (untested) Hamming forward error correction code and corresponding class
The system now uses a FECModem instance, which inherits the receive methods
etc. from Modem.
Up next: Make the modem's buffer read methods private and expose them in
error-corrected FECModem methods instead
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 new file mode 100644 index 0000000..dd36f68 --- /dev/null +++ b/src/fecmodem.h @@ -0,0 +1,20 @@ +#include <avr/io.h> +#include <stdlib.h> + +#ifndef FECMODEM_H_ +#define FECMODEM_H_ + +#include "hamming.h" +#include "modem.h" + +class FECModem : public Modem { + private: + uint8_t parity128(uint8_t byte); + uint8_t parity2416(uint8_t byte1, uint8_t byte2); + uint8_t correct128(uint8_t *byte, uint8_t parity); + uint8_t hamming2416(uint8_t *byte1, uint8_t *byte2, uint8_t parity); +}; + +extern FECModem modem; + +#endif /* FECMODEM_H_ */ |