no-OS
|
Header file of AD5933 Driver. More...
Go to the source code of this file.
Classes | |
struct | ad5933_dev |
struct | ad5933_init_param |
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. More... | |
int32_t | ad5933_remove (struct ad5933_dev *dev) |
Free the resources allocated by ad5933_init(). More... | |
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. More... | |
uint32_t | ad5933_get_register_value (struct ad5933_dev *dev, uint8_t register_address, uint8_t bytes_number) |
Reads the value of a register. More... | |
void | ad5933_reset (struct ad5933_dev *dev) |
Resets the device. More... | |
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. More... | |
void | ad5933_set_range_and_gain (struct ad5933_dev *dev, int8_t range, int8_t gain) |
Selects the range and gain of the device. More... | |
float | ad5933_get_temperature (struct ad5933_dev *dev) |
Reads the temperature from the part and returns the data in degrees Celsius. More... | |
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. More... | |
void | ad5933_start_sweep (struct ad5933_dev *dev) |
Starts the sweep operation. More... | |
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. More... | |
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. More... | |
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. More... | |
void | ad5933_set_settling_time (struct ad5933_dev *dev, uint8_t mulitplier, uint16_t number_cycles) |
Selects the number of settling cycles of the device. More... | |
Header file 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.
#define AD5933_15_CYCLES 15 |
#define AD5933_ADDR_POINTER 0xB0 |
#define AD5933_ADDRESS 0x0D |
#define AD5933_BLOCK_READ 0xA1 |
#define AD5933_BLOCK_WRITE 0xA0 |
#define AD5933_CONTROL_EXT_SYSCLK (0x1 << 3) |
#define AD5933_CONTROL_FUNCTION | ( | x | ) | ((x) << 4) |
#define AD5933_CONTROL_INT_SYSCLK (0x0 << 3) |
#define AD5933_CONTROL_PGA_GAIN | ( | x | ) | ((x) << 0) |
#define AD5933_CONTROL_RANGE | ( | x | ) | ((x) << 1) |
#define AD5933_CONTROL_RESET (0x1 << 4) |
#define AD5933_FUNCTION_INC_FREQ 0x3 |
#define AD5933_FUNCTION_INIT_START_FREQ 0x1 |
#define AD5933_FUNCTION_MEASURE_TEMP 0x9 |
#define AD5933_FUNCTION_NOP 0x0 |
#define AD5933_FUNCTION_POWER_DOWN 0xA |
#define AD5933_FUNCTION_REPEAT_FREQ 0x4 |
#define AD5933_FUNCTION_STANDBY 0xB |
#define AD5933_FUNCTION_START_SWEEP 0x2 |
#define AD5933_GAIN_X1 1 |
#define AD5933_GAIN_X5 0 |
#define AD5933_INTERNAL_SYS_CLK 16000000ul |
#define AD5933_MAX_INC_NUM 511 |
#define AD5933_RANGE_1000mVpp 0x3 |
#define AD5933_RANGE_2000mVpp 0x0 |
#define AD5933_RANGE_200mVpp 0x1 |
#define AD5933_RANGE_400mVpp 0x2 |
#define AD5933_REG_CONTROL_HB 0x80 |
#define AD5933_REG_CONTROL_LB 0x81 |
#define AD5933_REG_FREQ_INC 0x85 |
#define AD5933_REG_FREQ_START 0x82 |
#define AD5933_REG_IMAG_DATA 0x96 |
#define AD5933_REG_INC_NUM 0x88 |
#define AD5933_REG_REAL_DATA 0x94 |
#define AD5933_REG_SETTLING_CYCLES 0x8A |
#define AD5933_REG_STATUS 0x8F |
#define AD5933_REG_TEMP_DATA 0x92 |
#define AD5933_SETTLING_X1 0 |
#define AD5933_SETTLING_X2 1 |
#define AD5933_SETTLING_X4 3 |
#define AD5933_STAT_DATA_VALID (0x1 << 1) |
#define AD5933_STAT_SWEEP_DONE (0x1 << 2) |
#define AD5933_STAT_TEMP_VALID (0x1 << 0) |
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.
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.
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.
Configures the sweep parameters.
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.
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.
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.
Reads the temp. 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.
Initializes the communication peripheral.
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().
Free the resources allocated by ad5686_init().
dev | - The device structure. |
void ad5933_reset | ( | struct ad5933_dev * | dev | ) |
Resets the device.
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.
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.
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.
Selects the number of settling cycles.
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.
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.
Starts the sweep operation.
dev | - The device structure. |