libbladeRF: Sample rate

| libbladeRF 2.2.1-git Nuand bladeRF library

Data Structures | Typedefs | Functions
Sample rate
Channel control

## Description

This section presents functionality pertaining to configuring the sample rate and mode of the device's RX and TX channels.

These functions are thread-safe.

## Data Structures
struct | bladerf_rational_rate

## Typedefs
typedef unsigned int | bladerf_sample_rate

## Functions
API_EXPORT int CALL_CONV | bladerf_set_sample_rate (struct bladerf *dev, bladerf_channel ch, bladerf_sample_rate rate, bladerf_sample_rate *actual)
API_EXPORT int CALL_CONV | bladerf_set_rational_sample_rate (struct bladerf *dev, bladerf_channel ch, struct bladerf_rational_rate *rate, struct bladerf_rational_rate *actual)
API_EXPORT int CALL_CONV | bladerf_get_sample_rate (struct bladerf *dev, bladerf_channel ch, bladerf_sample_rate *rate)
API_EXPORT int CALL_CONV | bladerf_get_sample_rate_range (struct bladerf *dev, bladerf_channel ch, const struct bladerf_range **range)
API_EXPORT int CALL_CONV | bladerf_get_rational_sample_rate (struct bladerf *dev, bladerf_channel ch, struct bladerf_rational_rate *rate)

## Typedef Documentation

## ◆ bladerf_sample_rate

typedef unsigned int bladerf_sample_rate

Sample rate, in samples per second (sps)

Definition at line 1006 of file libbladeRF.h.

## Function Documentation

## ◆ bladerf_get_rational_sample_rate()

API_EXPORT int CALL_CONV bladerf_get_rational_sample_rate | ( | struct bladerf * | dev,
|  | bladerf_channel | ch,
|  | struct bladerf_rational_rate * | rate
| ) |  |

Get the channel's sample rate in rational Hz

Parameters

  | dev | Device handle
  [in] | ch | Channel
  [out] | rate | Current rational sample rate

Returns
  0 on success, value from Error codes list upon failure

## ◆ bladerf_get_sample_rate()

API_EXPORT int CALL_CONV bladerf_get_sample_rate | ( | struct bladerf * | dev,
|  | bladerf_channel | ch,
|  | bladerf_sample_rate * | rate
| ) |  |

Get the channel's current sample rate in Hz

Parameters

  | dev | Device handle
  [in] | ch | Channel
  [out] | rate | Current sample rate

Returns
  0 on success, value from Error codes list upon failure

## ◆ bladerf_get_sample_rate_range()

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

Get the channel's supported range of sample rates

Parameters

  | dev | Device handle
  [in] | ch | Channel
  [out] | range | Sample rate range

Returns
  0 on success, value from Error codes list upon failure

## ◆ bladerf_set_rational_sample_rate()

API_EXPORT int CALL_CONV bladerf_set_rational_sample_rate | ( | struct bladerf * | dev,
|  | bladerf_channel | ch,
|  | struct bladerf_rational_rate * | rate,
|  | struct bladerf_rational_rate * | actual
| ) |  |

Configure the channel's sample rate as a rational fraction of Hz.

See also
  Use bladerf_get_sample_rate_range() to determine the range of supported sample rates.

Parameters

  | dev | Device handle
  [in] | ch | Channel to change
  [in] | rate | Rational sample rate
  [out] | actual | If non-NULL, this is written with the actual rational sample rate achieved.

Returns
  0 on success, value from Error codes list upon failure

## ◆ bladerf_set_sample_rate()

API_EXPORT int CALL_CONV bladerf_set_sample_rate | ( | struct bladerf * | dev,
|  | bladerf_channel | ch,
|  | bladerf_sample_rate | rate,
|  | bladerf_sample_rate * | actual
| ) |  |

Configure the channel's sample rate to the specified rate in Hz.

Note
  This requires the sample rate is an integer value of Hz. Use bladerf_set_rational_sample_rate() for more arbitrary values.

See also
  Use bladerf_get_sample_rate_range() to determine the range of supported sample rates.

Parameters

  | dev | Device handle
  [in] | ch | Channel
  [in] | rate | Sample rate
  [out] | actual | If non-NULL, this is written with the actual sample rate achieved.

Returns
  0 on success, value from Error codes list upon failure