hamnet70/impl/src/utils.h
Thomas Kolb c8e0516e80 Implement time-based carrier sensing
In the following events, the modem cannot switch to transmit mode for the
given time:

- after a preamble has been received, for 500 ms
- after a packet has been successfully decoded, for 1 ms
- after receive mode was initially enabled, for 500 ms

Note that the times are that long to work around the RX/TX switching of
the hackrf and can be hopefully reduced to <10 milliseconds in a later
version.
2022-05-07 21:17:53 +02:00

32 lines
917 B
C

#ifndef UTILS_H
#define UTILS_H
#include <stdlib.h>
#include <stdbool.h>
#include <liquid/liquid.h>
/*! Dump a array of complex numbers.
*
* \param data Pointer to the data to dump.
* \param n Number of data points to dump.
* \param T The sampling interval of the data (set to 1.0 if not relevant).
* \param filename The file to write to.
*/
bool dump_array_cf(const float complex *data, size_t n, float T, const char *filename);
/*! Dump a array of real numbers.
*
* \param data Pointer to the data to dump.
* \param n Number of data points to dump.
* \param T The sampling interval of the data (set to 1.0 if not relevant).
* \param filename The file to write to.
*/
bool dump_array_f(const float *data, size_t n, float T, const char *filename);
void sleep_until(double hires_time);
void fsleep(double d);
double get_hires_time(void);
#endif // UTILS_H