STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
link.cpp
Go to the documentation of this file.
1#include "link.h"
2
3#include "radio.h"
4
5namespace radio_link {
6
7ArmAction Link::poll(uint32_t now_ms) {
8 uint8_t len = 0;
9
10 gate_.tick(now_ms);
11
12 const RadioStatus rs = radio_receive(buf_, sizeof buf_, len);
13 if (rs == RadioStatus::NoData) {
14 return ArmAction::None;
15 }
16 if (rs == RadioStatus::ErrTooLong) {
17 frames_dropped_++; // a packet arrived but could not be used
18 return ArmAction::None;
19 }
20 if (rs != RadioStatus::Ok) {
21 radio_errors_++; // the radio itself did not answer
22 return ArmAction::None;
23 }
26 return ArmAction::None;
27 }
28 frames_ok_++;
29 return gate_.on_frame(frame_, now_ms);
30}
31
32} // namespace radio_link