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

@ -22,6 +22,8 @@
#ifndef __BASEBAND_PACKET_H__
#define __BASEBAND_PACKET_H__
#include "baseband.hpp"
#include <cstddef>
#include <bitset>
@ -29,6 +31,14 @@ namespace baseband {
class Packet {
public:
void set_timestamp(const Timestamp& value) {
timestamp_ = value;
}
Timestamp timestamp() const {
return timestamp_;
}
void add(const bool symbol) {
if( count < capacity() ) {
data[count++] = symbol;
@ -53,6 +63,7 @@ public:
private:
std::bitset<1408> data;
Timestamp timestamp_ { };
size_t count { 0 };
};