libbladeRF
2.5.0
Nuand bladeRF library
|
These functions provide control over the device's RX and TX gain stages.
These functions are thread-safe.
Data Structures | |
struct | bladerf_gain_modes |
Typedefs | |
typedef int | bladerf_gain |
Enumerations | |
enum | bladerf_gain_mode { BLADERF_GAIN_DEFAULT , BLADERF_GAIN_MGC , BLADERF_GAIN_FASTATTACK_AGC , BLADERF_GAIN_SLOWATTACK_AGC , BLADERF_GAIN_HYBRID_AGC } |
Macros | |
#define | BLADERF_GAIN_AUTOMATIC BLADERF_GAIN_DEFAULT |
#define | BLADERF_GAIN_MANUAL BLADERF_GAIN_MGC |
typedef int bladerf_gain |
Gain value, in decibels (dB)
May be positive or negative.
Definition at line 748 of file libbladeRF.h.
enum bladerf_gain_mode |
Gain control modes
In general, the default mode is automatic gain control. This will continuously adjust the gain to maximize dynamic range and minimize clipping.
Definition at line 760 of file libbladeRF.h.
#define BLADERF_GAIN_AUTOMATIC BLADERF_GAIN_DEFAULT |
Default AGC mode (for backwards compatibility with libbladeRF 1.x)
Definition at line 800 of file libbladeRF.h.
#define BLADERF_GAIN_MANUAL BLADERF_GAIN_MGC |
Manual gain control (for backwards compatibility with libbladeRF 1.x)
Definition at line 802 of file libbladeRF.h.
API_EXPORT int CALL_CONV bladerf_get_gain | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
bladerf_gain * | gain | ||
) |
Get overall system gain
dev | Device handle | |
[in] | ch | Channel |
[out] | gain | Gain, in dB |
API_EXPORT int CALL_CONV bladerf_get_gain_mode | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
bladerf_gain_mode * | mode | ||
) |
Get gain control mode
Gets the current mode for hardware AGC. If the channel or board does not meaningfully have a gain mode (e.g. transmit channels), mode will be set to BLADERF_GAIN_DEFAULT and 0
will be returned.
dev | Device handle | |
[in] | ch | Channel |
[out] | mode | Gain mode |
API_EXPORT int CALL_CONV bladerf_get_gain_modes | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
const struct bladerf_gain_modes ** | modes | ||
) |
Get available gain control modes
Populates modes
with a pointer to an array of structs containing the supported gain modes.
This function may be called with NULL
for modes
to determine the number of gain modes supported.
dev | Device handle | |
[in] | ch | Channel |
[out] | modes | Supported gain modes |
API_EXPORT int CALL_CONV bladerf_get_gain_range | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
const struct bladerf_range ** | range | ||
) |
Get range of overall system gain
dev | Device handle | |
[in] | ch | Channel |
[out] | range | Gain range |
API_EXPORT int CALL_CONV bladerf_get_gain_stage | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
const char * | stage, | ||
bladerf_gain * | gain | ||
) |
Set the gain for a specific gain stage
dev | Device handle | |
[in] | ch | Channel |
[in] | stage | Gain stage name |
[out] | gain | Gain |
Note that, in some cases, gain may be negative (e.g. transmit channels).
API_EXPORT int CALL_CONV bladerf_get_gain_stage_range | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
const char * | stage, | ||
const struct bladerf_range ** | range | ||
) |
Get gain range of a specific gain stage
This function may be called with NULL
for range
to test if a given gain range exists.
dev | Device handle | |
[in] | ch | Channel |
[in] | stage | Gain stage name |
[out] | range | Gain range |
API_EXPORT int CALL_CONV bladerf_get_gain_stages | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
const char ** | stages, | ||
size_t | count | ||
) |
Get a list of available gain stages
This function may be called with NULL
for stages
, or 0 for count
, to determine the number of gain stages.
dev | Device handle | |
[in] | ch | Channel |
[out] | stages | Gain stage names |
[out] | count | Number to populate |
API_EXPORT int CALL_CONV bladerf_set_gain | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
bladerf_gain | gain | ||
) |
Set overall system gain
This sets an overall system gain, optimally proportioning the gain between multiple gain stages if applicable.
On receive channels, 60 dB is the maximum gain level.
On transmit channels, 60 dB is defined as approximately 0 dBm. Note that this is not a calibrated value, and the actual output power will vary based on a multitude of factors.
dev | Device handle | |
[in] | ch | Channel |
[in] | gain | Desired gain, in dB |
API_EXPORT int CALL_CONV bladerf_set_gain_mode | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
bladerf_gain_mode | mode | ||
) |
Set gain control mode
Sets the mode for hardware AGC. Not all channels or boards will support all possible values (e.g. transmit channels); invalid combinations will return BLADERF_ERR_UNSUPPORTED.
The special value of BLADERF_GAIN_DEFAULT will return hardware AGC to its default value at initialization.
dev | Device handle | |
[in] | ch | Channel |
[in] | mode | Desired gain mode |
API_EXPORT int CALL_CONV bladerf_set_gain_stage | ( | struct bladerf * | dev, |
bladerf_channel | ch, | ||
const char * | stage, | ||
bladerf_gain | gain | ||
) |
Set the gain for a specific gain stage
dev | Device handle | |
[in] | ch | Channel |
[in] | stage | Gain stage name |
[in] | gain | Desired gain |