Move packet timestamping into baseband.

Now reads the RTC peripheral at the end of each received packet.
TODO: Improve resolution to milliseconds or better.
TODO: Work back from end of packet to compute timestamp for beginning of packet.
TODO: Reuse ChibiOS RTC code, which isn't used now because ChibiOS on M0 core is responsible for RTC configuration, and including ChibiOS RTC API on M4 will also try to initialize/manage the peripheral.
This commit is contained in:
Jared Boone 2015-12-12 11:37:30 -08:00
parent c825a027b2
commit b058d609eb
10 changed files with 62 additions and 38 deletions

View file

@ -29,9 +29,6 @@
#include "baseband_packet.hpp"
#include "manchester.hpp"
#include "lpc43xx_cpp.hpp"
using namespace lpc43xx;
namespace ert {
using ID = uint32_t;
@ -46,11 +43,9 @@ public:
};
Packet(
const rtc::RTC& received_at,
const Type type,
const baseband::Packet& packet
) : packet_ { packet },
received_at_ { received_at },
decoder_ { packet_ },
reader_ { decoder_ },
type_ { type }
@ -61,7 +56,7 @@ public:
bool is_valid() const;
rtc::RTC received_at() const;
Timestamp received_at() const;
Type type() const;
ID id() const;
@ -75,7 +70,6 @@ private:
using Reader = FieldReader<ManchesterDecoder, BitRemapNone>;
const baseband::Packet packet_;
const rtc::RTC received_at_;
const ManchesterDecoder decoder_;
const Reader reader_;
const Type type_;