STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
radio.h
Go to the documentation of this file.
1
#ifndef RADIO_H
2
#define RADIO_H
3
4
#include <stddef.h>
5
#include <stdint.h>
6
7
namespace
radio_link
{
8
9
// The answers a radio function can give.
10
enum class
RadioStatus
: uint8_t {
11
Ok
= 0,
// it worked
12
ErrNotFound
,
// the radio chip did not answer
13
ErrTooLong
,
// a packet was bigger than the space we gave it
14
NoData
,
// nothing has arrived yet (this is not a failure)
15
ErrTimeout
,
// the operation did not complete before its deadline
16
NotImplemented
,
// no transport implementation is installed
17
};
18
19
// Check the radio chip is there and answering (for example by reading one of
20
// its status registers). Call this once at boot.
21
// Returns Ok if it answers, ErrNotFound if it does not.
22
RadioStatus
radio_probe
();
23
24
// Check whether a packet has arrived, without waiting. The caller provides a
25
// box (`buf`) that holds up to `max_len` bytes.
26
// - A packet is waiting: it is copied into `buf`, `len` is set to its size,
27
// and the answer is Ok.
28
// - Nothing is waiting: the answer is NoData and `len` is left alone.
29
// - The waiting packet is bigger than `max_len`: it is thrown away and the
30
// answer is ErrTooLong.
31
RadioStatus
radio_receive
(uint8_t* buf, uint8_t max_len, uint8_t& len);
32
33
// Send one packet: `len` bytes (1 to 255) starting at `bytes`.
34
// Return Ok only after SX1262 TxDone, within a bounded driver timeout.
35
// Queueing a packet is insufficient; no ground-station ACK is required.
36
// Return ErrTimeout on expiry and NotImplemented for an absent transport.
37
// Self-test sends heartbeats and reports; a no-op must never return Ok.
38
RadioStatus
radio_send
(
const
uint8_t* bytes, uint8_t len);
39
40
}
// namespace radio_link
41
42
#endif
// RADIO_H
radio_link
Definition
sx1262.cpp:5
radio_link::SetupStep::Ok
@ Ok
Definition
sx1262_setup.h:51
radio_link::radio_receive
RadioStatus radio_receive(uint8_t *buf, uint8_t max_len, uint8_t &len)
Definition
radio_task.cpp:178
radio_link::radio_probe
RadioStatus radio_probe()
Definition
radio_task.cpp:175
radio_link::RadioStatus
RadioStatus
Definition
radio.h:10
radio_link::RadioStatus::ErrTooLong
@ ErrTooLong
Definition
radio.h:13
radio_link::RadioStatus::ErrNotFound
@ ErrNotFound
Definition
radio.h:12
radio_link::RadioStatus::NotImplemented
@ NotImplemented
Definition
radio.h:16
radio_link::RadioStatus::ErrTimeout
@ ErrTimeout
Definition
radio.h:15
radio_link::RadioStatus::NoData
@ NoData
Definition
radio.h:14
radio_link::radio_send
RadioStatus radio_send(const uint8_t *bytes, uint8_t len)
Definition
radio_task.cpp:181
firmware
Flight_Computer
src
radio
radio.h
Generated by
1.15.0