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

@ -26,9 +26,6 @@ using namespace portapack;
#include "manchester.hpp"
#include "lpc43xx_cpp.hpp"
using namespace lpc43xx;
#include "crc.hpp"
#include "string_format.hpp"
@ -61,9 +58,7 @@ void ERTView::on_show() {
message_map.register_handler(Message::ID::ERTPacket,
[this](Message* const p) {
const auto message = static_cast<const ERTPacketMessage*>(p);
rtc::RTC datetime;
rtcGetTime(&RTCD1, &datetime);
const ert::Packet packet { datetime, message->type, message->packet };
const ert::Packet packet { message->type, message->packet };
if( this->model.on_packet(packet) ) {
this->on_packet(packet);
}