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

@ -25,9 +25,6 @@
#include "baseband_packet.hpp"
#include "field_reader.hpp"
#include "lpc43xx_cpp.hpp"
using namespace lpc43xx;
#include <cstdint>
#include <cstddef>
#include <string>
@ -51,10 +48,8 @@ using MMSI = uint32_t;
class Packet {
public:
constexpr Packet(
const rtc::RTC& received_at,
const baseband::Packet& packet
) : packet_ { packet },
received_at_ { received_at },
field_ { packet_ }
{
}
@ -63,7 +58,7 @@ public:
bool is_valid() const;
rtc::RTC received_at() const;
Timestamp received_at() const;
uint32_t message_id() const;
MMSI user_id() const;
@ -85,7 +80,6 @@ private:
using CRCReader = FieldReader<baseband::Packet, BitRemapNone>;
const baseband::Packet packet_;
const rtc::RTC received_at_;
const Reader field_;
const size_t fcs_length = 16;