From 05badadddac3f3100b54528d73c41be97840a50a Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sat, 26 Sep 2015 14:15:39 -0700 Subject: [PATCH] Put symbol coding into PacketBuilder. Removes stuffing symbols before placing them into packet buffer. --- firmware/baseband/packet_builder.cpp | 1 + firmware/baseband/packet_builder.hpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/firmware/baseband/packet_builder.cpp b/firmware/baseband/packet_builder.cpp index 587d557a..cae20b38 100644 --- a/firmware/baseband/packet_builder.cpp +++ b/firmware/baseband/packet_builder.cpp @@ -30,5 +30,6 @@ void PacketBuilder::configure(size_t new_payload_length) { void PacketBuilder::reset_state() { bits_received = 0; + unstuff.reset(); state = State::AccessCodeSearch; } diff --git a/firmware/baseband/packet_builder.hpp b/firmware/baseband/packet_builder.hpp index d1476846..7d8bd1c5 100644 --- a/firmware/baseband/packet_builder.hpp +++ b/firmware/baseband/packet_builder.hpp @@ -26,6 +26,8 @@ #include #include +#include "symbol_coding.hpp" + class PacketBuilder { public: void configure(size_t new_payload_length); @@ -45,7 +47,9 @@ public: case State::Payload: if( bits_received < payload_length ) { - payload[bits_received++] = symbol; + if( !unstuff.is_stuffing_bit(symbol) ) { + payload[bits_received++] = symbol; + } } else { payload_handler(payload, bits_received); reset_state(); @@ -68,6 +72,7 @@ private: size_t bits_received { 0 }; State state { State::AccessCodeSearch }; std::bitset<256> payload; + symbol_coding::Unstuff unstuff; void reset_state(); };