Implementation of AD5933 Driver. More...
Functions | |
int32_t | ad5933_init (struct ad5933_dev **device, struct ad5933_init_param init_param) |
Initializes the communication peripheral and the initial Values for AD5933 Board. | |
int32_t | ad5933_remove (struct ad5933_dev *dev) |
Free the resources allocated by ad5933_init(). | |
void | ad5933_set_register_value (struct ad5933_dev *dev, uint8_t register_address, uint32_t register_value, uint8_t bytes_number) |
Writes data into a register. | |
uint32_t | ad5933_get_register_value (struct ad5933_dev *dev, uint8_t register_address, uint8_t bytes_number) |
Reads the value of a register. | |
void | ad5933_reset (struct ad5933_dev *dev) |
Resets the device. | |
void | ad5933_set_system_clk (struct ad5933_dev *dev, int8_t clk_source, uint32_t ext_clk_freq) |
Selects the source of the system clock. | |
void | ad5933_set_range_and_gain (struct ad5933_dev *dev, int8_t range, int8_t gain) |
Selects the range and gain of the device. | |
float | ad5933_get_temperature (struct ad5933_dev *dev) |
Reads the temperature from the part and returns the data in degrees Celsius. | |
void | ad5933_config_sweep (struct ad5933_dev *dev, uint32_t start_freq, uint32_t inc_freq, uint16_t inc_num) |
Configures the sweep parameters: Start frequency, Frequency increment and Number of increments. | |
void | ad5933_start_sweep (struct ad5933_dev *dev) |
Starts the sweep operation. | |
void | ad5933_get_data (struct ad5933_dev *dev, uint8_t freq_function, short *imag_data, short *real_data) |
Reads the real and imaginary value from register. | |
double | ad5933_calculate_gain_factor (struct ad5933_dev *dev, uint32_t calibration_impedance, uint8_t freq_function) |
Reads the real and the imaginary data and calculates the Gain Factor. | |
double | ad5933_calculate_impedance (struct ad5933_dev *dev, double gain_factor, uint8_t freq_function) |
Reads the real and the imaginary data and calculates the Impedance. | |
void | ad5933_set_settling_time (struct ad5933_dev *dev, uint8_t multiplier, uint16_t number_cycles) |
Selects the number of settling cycles of the device. | |
Variables | |
const int32_t | pow_2_27 = 134217728ul |
Implementation of AD5933 Driver.
Copyright 2012(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
double ad5933_calculate_gain_factor | ( | struct ad5933_dev * | dev, |
uint32_t | calibration_impedance, | ||
uint8_t | freq_function ) |
Reads the real and the imaginary data and calculates the Gain Factor.
dev | - The device structure. |
calibration_impedance | - The calibration impedance value. |
freq_function | - Frequency function. Example: AD5933_FUNCTION_INC_FREQ - Increment freq.; AD5933_FUNCTION_REPEAT_FREQ - Repeat freq.. |
double ad5933_calculate_impedance | ( | struct ad5933_dev * | dev, |
double | gain_factor, | ||
uint8_t | freq_function ) |
Reads the real and the imaginary data and calculates the Impedance.
dev | - The device structure. |
gain_factor | - The gain factor. |
freq_function | - Frequency function. Example: AD5933_FUNCTION_INC_FREQ - Increment freq.; AD5933_FUNCTION_REPEAT_FREQ - Repeat freq.. |
void ad5933_config_sweep | ( | struct ad5933_dev * | dev, |
uint32_t | start_freq, | ||
uint32_t | inc_freq, | ||
uint16_t | inc_num ) |
Configures the sweep parameters: Start frequency, Frequency increment and Number of increments.
dev | - The device structure. |
start_freq | - Start frequency in Hz; |
inc_freq | - Frequency increment in Hz; |
inc_num | - Number of increments. Maximum value is 511(0x1FF). |
void ad5933_get_data | ( | struct ad5933_dev * | dev, |
uint8_t | freq_function, | ||
short * | imag_data, | ||
short * | real_data ) |
Reads the real and imaginary value from register.
dev | - The device structure. |
freq_function | - Frequency function. |
imag_data | - Pointer to imaginary data |
real_data | - Pointer to real data |
uint32_t ad5933_get_register_value | ( | struct ad5933_dev * | dev, |
uint8_t | register_address, | ||
uint8_t | bytes_number ) |
Reads the value of a register.
dev | - The device structure. |
register_address | - Address of the register. |
bytes_number | - Number of bytes. |
float ad5933_get_temperature | ( | struct ad5933_dev * | dev | ) |
Reads the temperature from the part and returns the data in degrees Celsius.
dev | - The device structure. |
int32_t ad5933_init | ( | struct ad5933_dev ** | device, |
struct ad5933_init_param | init_param ) |
Initializes the communication peripheral and the initial Values for AD5933 Board.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t ad5933_remove | ( | struct ad5933_dev * | dev | ) |
Free the resources allocated by ad5933_init().
dev | - The device structure. |
void ad5933_reset | ( | struct ad5933_dev * | dev | ) |
Resets the device.
dev | - The device structure. |
void ad5933_set_range_and_gain | ( | struct ad5933_dev * | dev, |
int8_t | range, | ||
int8_t | gain ) |
Selects the range and gain of the device.
dev | - The device structure. |
range | - Range option. Example: AD5933_RANGE_2000mVpp AD5933_RANGE_200mVpp AD5933_RANGE_400mVpp |
AD5933_RANGE_1000mVpp
gain | - Gain option. Example: AD5933_GAIN_X5 AD5933_GAIN_X1 |
void ad5933_set_register_value | ( | struct ad5933_dev * | dev, |
uint8_t | register_address, | ||
uint32_t | register_value, | ||
uint8_t | bytes_number ) |
Writes data into a register.
dev | - The device structure. |
register_address | - Address of the register. |
register_value | - Data value to write. |
bytes_number | - Number of bytes. |
void ad5933_set_settling_time | ( | struct ad5933_dev * | dev, |
uint8_t | multiplier, | ||
uint16_t | number_cycles ) |
Selects the number of settling cycles of the device.
dev | - The device structure. |
number_cycles | - 9-bit number of cycles to wait before triggering ADC |
multiplier | - Multiply number of cycles by X1, X2 or X4 Example: AD5933_SETTLING_X1 AD5933_SETTLING_X2 AD5933_SETTLING_X4 |
void ad5933_set_system_clk | ( | struct ad5933_dev * | dev, |
int8_t | clk_source, | ||
uint32_t | ext_clk_freq ) |
Selects the source of the system clock.
dev | - The device structure. |
clk_source | - Selects the source of the system clock. Example: AD5933_CONTROL_INT_SYSCLK AD5933_CONTROL_EXT_SYSCLK |
ext_clk_freq | - Frequency value of the external clock, if used. |
void ad5933_start_sweep | ( | struct ad5933_dev * | dev | ) |
Starts the sweep operation.
dev | - The device structure. |
const int32_t pow_2_27 = 134217728ul |