Files
adsb-tools/adsbus/common.h

42 lines
799 B
C
Raw Normal View History

2016-02-15 20:01:48 +00:00
#pragma once
#include <stdint.h>
2016-02-15 20:01:48 +00:00
2016-02-14 20:35:43 +00:00
//////// packet
2016-02-14 22:26:34 +00:00
#define DATA_LEN_MAX 14
struct packet {
enum {
MODE_S_SHORT,
MODE_S_LONG,
} type;
2016-02-17 18:01:39 -08:00
#define NUM_TYPES 2
2016-02-16 19:26:30 +00:00
uint8_t payload[DATA_LEN_MAX];
uint64_t mlat_timestamp;
uint32_t rssi;
};
2016-02-17 08:30:32 +00:00
extern char *packet_type_names[];
//////// mlat
#define MLAT_MHZ 120
// Use the signed max to avoid problems with some consumers; it's large enough to not matter.
#define MLAT_MAX INT64_MAX
#define RSSI_MAX UINT32_MAX
struct mlat_state {
uint64_t timestamp_last;
uint64_t timestamp_generation;
};
uint64_t mlat_timestamp_scale_in(uint64_t, uint64_t, uint16_t, struct mlat_state *);
2016-02-17 18:01:39 -08:00
uint64_t mlat_timestamp_scale_out(uint64_t, uint64_t, uint16_t);
//////// rssi
uint32_t rssi_scale_in(uint32_t, uint32_t);
2016-02-17 18:01:39 -08:00
uint32_t rssi_scale_out(uint32_t, uint32_t);