STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
fake_air.h
Go to the documentation of this file.
1#ifndef FAKE_AIR_H
2#define FAKE_AIR_H
3
4// Models LoRa RF listen windows for sniff-mode tests.
5//
6// In SetRxDutyCycle, the radio listens for rx_ms then sleeps for sleep_ms,
7// repeating autonomously. A packet is received only if its preamble overlaps
8// at least one listen window. This is the key constraint: the ground station's
9// preamble must be longer than sleep_ms to guarantee delivery; a short
10// preamble can be missed entirely if it falls in the sleep window.
11
12#include <stdbool.h>
13#include <stdint.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19// Set the duty cycle; call before fake_air_packet_heard().
20void fake_air_configure(uint32_t rx_ms, uint32_t sleep_ms);
21
22// Can the radio hear a packet whose preamble starts at cycle_offset_ms within
23// the duty cycle period (0 = start of listen window) and lasts preamble_ms?
24// Returns true if any part of the preamble overlaps a listen window.
25bool fake_air_packet_heard(uint32_t cycle_offset_ms, uint32_t preamble_ms);
26
27// Average radio current in mA over one duty cycle, given the per-state values.
28// rx_ma: current while listening (SX1262 DS p.16: ~4.6 mA at 125 kHz DC-DC)
29// sleep_ua: current while sleeping (~1.2 µA warm sleep, DS p.16)
30float fake_air_average_current_ma(float rx_ma, float sleep_ua);
31
32#ifdef __cplusplus
33}
34#endif
35#endif
float fake_air_average_current_ma(float rx_ma, float sleep_ua)
Definition fake_air.c:33
void fake_air_configure(uint32_t rx_ms, uint32_t sleep_ms)
Definition fake_air.c:6
bool fake_air_packet_heard(uint32_t cycle_offset_ms, uint32_t preamble_ms)
Definition fake_air.c:11