esp-sdr-zephyr
Raw I/Q receive and transmit on the ESP32-S3/C6 Wi-Fi radio, for Zephyr
Loading...
Searching...
No Matches
esp_sdr_tx.h File Reference

ESP-SDR transmit: power steps, one-shot DAC playback and sweeps, and the streaming interface with its backends. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <esp_sdr/esp_sdr.h>

Go to the source code of this file.

Data Structures

struct  esp_sdr_tx_sweep_stats
struct  esp_sdr_tx_backend
struct  esp_sdr_tx_stats
struct  esp_sdr_tx_dac_stats

Macros

#define ESP_SDR_TX_PLAY_MAX_MS   5000U

Typedefs

typedef void(* esp_sdr_tx_dac_gen_t) (void *user, uint32_t *dst, uint64_t index, uint32_t n)

Functions

int esp_sdr_tx_set_gain (int index)
 Select a transmit power step, picked up by the next transmission.
int esp_sdr_tx_get_gain (void)
int esp_sdr_tx_gain_max (void)
int esp_sdr_tx_gain_power (int index)
int esp_sdr_tx_set_lpf (int code_a, int code_b)
 Select the TX baseband low-pass capacitor codes (experimental).
uint32_t esp_sdr_tx_rate_hz (enum esp_sdr_rate rate)
static uint32_t esp_sdr_tx_word (int16_t i, int16_t q)
int esp_sdr_tx_play (enum esp_sdr_rate rate, const uint32_t *words, size_t count)
 Play one burst of complex samples out through the TX DAC.
int esp_sdr_tx_play_for (enum esp_sdr_rate rate, const uint32_t *words, size_t count, uint32_t duration_ms, uint32_t *bursts)
 Replay one burst back to back for a while, like esp_sdr_tx_play().
int esp_sdr_tx_sweep (enum esp_sdr_rate rate, float f0_hz, float f1_hz, uint32_t duration_ms, int amp, struct esp_sdr_tx_sweep_stats *stats)
 Transmit a linear frequency sweep at fixed power.
int esp_sdr_tx_loop_begin (enum esp_sdr_rate rate)
 Take the radio and switch the front end to TX at the selected step.
uint32_t * esp_sdr_tx_loop_buf (int bank, size_t *words)
int esp_sdr_tx_loop_start (int bank, size_t count)
 (Re)start looping over the first count words of bank.
void esp_sdr_tx_loop_halt (void)
 Stop playback at once; the session stays open.
void esp_sdr_tx_loop_end (void)
 Stop playback, back to RX, release the radio.
int esp_sdr_tx_set_backend (const struct esp_sdr_tx_backend *backend)
 Select the streaming backend; NULL restores the default (DAC if built, else the stub).
const struct esp_sdr_tx_backend * esp_sdr_tx_get_backend (void)
int esp_sdr_tx_start (uint64_t freq_hz, uint32_t rate_hz)
 Start streaming.
int esp_sdr_tx_write (const struct esp_sdr_iq16 *samples, size_t count)
 Hand samples to the backend.
int esp_sdr_tx_stop (void)
 Stop streaming; no-op when stopped.
bool esp_sdr_tx_active (void)
void esp_sdr_tx_get_stats (struct esp_sdr_tx_stats *stats)
void esp_sdr_tx_dac_get_stats (struct esp_sdr_tx_dac_stats *stats)
int esp_sdr_tx_dac_play_gen (esp_sdr_tx_dac_gen_t gen, void *user, uint64_t samples)
 Play samples generated DAC samples gapless at the current LO.
uint32_t esp_sdr_tx_dac_queued (void)

Variables

const struct esp_sdr_tx_backend esp_sdr_tx_stub_backend
const struct esp_sdr_tx_backend esp_sdr_tx_dac_backend

Detailed Description

ESP-SDR transmit: power steps, one-shot DAC playback and sweeps, and the streaming interface with its backends.

One-shot calls (esp_sdr_tx_play(), esp_sdr_tx_sweep()) play prepared words from the dump bank. The streaming interface takes complex 16-bit samples at a low rate and hands them to a backend: the DAC backend (CONFIG_ESP_SDR_TX_DAC) interpolates them to 40 MS/s and plays them gapless, the stub backend only counts them.

The one-shot, power and loop calls exist on the ESP32-S3 only, the streaming interface with CONFIG_ESP_SDR_TX; the ESP32-C6 has esp_sdr_tx_set_lpf() (returning -ENOTSUP) and esp_sdr_tx_word() only.