libbladeRF  2.2.1
Nuand bladeRF library
Typedefs | Macros | Functions

Description

These functions provide the ability to tune the RX and TX channels.

See this page for more detailed information about how the API performs this tuning, and for example code snippets.

These functions are thread-safe.

Typedefs

typedef uint64_t bladerf_frequency
 

Macros

#define BLADERF_PRIuFREQ   PRIu64
 
#define BLADERF_PRIxFREQ   PRIx64
 
#define BLADERF_SCNuFREQ   SCNu64
 
#define BLADERF_SCNxFREQ   SCNx64
 

Functions

API_EXPORT int CALL_CONV bladerf_select_band (struct bladerf *dev, bladerf_channel ch, bladerf_frequency frequency)
 
API_EXPORT int CALL_CONV bladerf_set_frequency (struct bladerf *dev, bladerf_channel ch, bladerf_frequency frequency)
 
API_EXPORT int CALL_CONV bladerf_get_frequency (struct bladerf *dev, bladerf_channel ch, bladerf_frequency *frequency)
 
API_EXPORT int CALL_CONV bladerf_get_frequency_range (struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
 

Typedef Documentation

◆ bladerf_frequency

typedef uint64_t bladerf_frequency

RF center frequency, in hertz (Hz)

See also
Format macros for fprintf() and fscanf(): BLADERF_PRIuFREQ, BLADERF_PRIxFREQ, BLADERF_SCNuFREQ, BLADERF_SCNxFREQ
Remarks
Prior to libbladeRF 2.0.0, frequencies were specified as unsigned int.

Definition at line 1204 of file libbladeRF.h.

Macro Definition Documentation

◆ BLADERF_PRIuFREQ

#define BLADERF_PRIuFREQ   PRIu64

printf format for frequencies in unsigned decimal

Definition at line 1207 of file libbladeRF.h.

◆ BLADERF_PRIxFREQ

#define BLADERF_PRIxFREQ   PRIx64

printf format for frequencies in hexadecimal

Definition at line 1209 of file libbladeRF.h.

◆ BLADERF_SCNuFREQ

#define BLADERF_SCNuFREQ   SCNu64

scanf format for frequencies in unsigned decimal

Definition at line 1211 of file libbladeRF.h.

◆ BLADERF_SCNxFREQ

#define BLADERF_SCNxFREQ   SCNx64

scanf format for frequencies in hexadecimal

Definition at line 1213 of file libbladeRF.h.

Function Documentation

◆ bladerf_get_frequency()

API_EXPORT int CALL_CONV bladerf_get_frequency ( struct bladerf *  dev,
bladerf_channel  ch,
bladerf_frequency frequency 
)

Get channel's current frequency in Hz

Parameters
devDevice handle
[in]chChannel
[out]frequencyCurrent frequency
Returns
0 on success, value from Error codes list on failure

◆ bladerf_get_frequency_range()

API_EXPORT int CALL_CONV bladerf_get_frequency_range ( struct bladerf *  dev,
bladerf_channel  ch,
const struct bladerf_range **  range 
)

Get the supported range of frequencies for a channel

Parameters
devDevice handle
[in]chChannel
[out]rangeFrequency range
Returns
0 on success, value from Error codes list on failure

◆ bladerf_select_band()

API_EXPORT int CALL_CONV bladerf_select_band ( struct bladerf *  dev,
bladerf_channel  ch,
bladerf_frequency  frequency 
)

Select the appropriate band path given a frequency in Hz.

Note
Most API users will not need to use this function, as bladerf_set_frequency() calls this internally after tuning the device.

The high band is used for frequency above 1.5 GHz on bladeRF1 and above 3.0 GHz on bladeRF2. Otherwise, the low band is used.

See also
bladerf_get_frequency_range() to determine the range of supported frequencies.
Parameters
devDevice handle
[in]chChannel
[in]frequencyTuned frequency
Returns
0 on success, value from Error codes list on failure

◆ bladerf_set_frequency()

API_EXPORT int CALL_CONV bladerf_set_frequency ( struct bladerf *  dev,
bladerf_channel  ch,
bladerf_frequency  frequency 
)

Set channel's frequency in Hz.

Note
On the bladeRF1 platform, it is recommended to keep the RX and TX frequencies at least 1 MHz apart, and to digitally mix on the RX side if reception closer to the TX frequency is required.
On the bladeRF2, there is one oscillator for all RX channels and one oscillator for all TX channels. Therefore, changing one channel will change the frequency of all channels in that direction.

This function calls bladerf_select_band() internally, and performs all other tasks required to prepare the channel for the given frequency.

See also
bladerf_get_frequency_range() to determine the range of supported frequencies.
Parameters
devDevice handle
[in]chChannel
[in]frequencyDesired frequency
Returns
0 on success, value from Error codes list on failure