no-OS
Functions
ad5421.c File Reference
#include <stdlib.h>
#include "ad5421.h"
#include "no_os_alloc.h"
Include dependency graph for ad5421.c:

Functions

int32_t ad5421_init (struct ad5421_dev **device, struct ad5421_init_param init_param)
 Initialize SPI and Initial Values for AD5421 Board. More...
 
int32_t ad5421_remove (struct ad5421_dev *dev)
 Free the resources allocated by ad5421_init(). More...
 
void ad5421_set_dac (struct ad5421_dev *dev, int32_t dac_value)
 Write to the DAC register. More...
 
void ad5421_set_offset (struct ad5421_dev *dev, int32_t offset_value)
 Write to the Offset Adjust register. More...
 
void ad5421_set_gain (struct ad5421_dev *dev, int32_t gain_value)
 Write to the Gain Adjust register. More...
 
int32_t ad5421_get_dac (struct ad5421_dev *dev)
 Read from the DAC register. More...
 
int32_t ad5421_get_offset (struct ad5421_dev *dev)
 Read from the Offset Adjust register. More...
 
int32_t ad5421_get_gain (struct ad5421_dev *dev)
 Read from the Gain Adjust register. More...
 
int32_t ad5421_get_fault (struct ad5421_dev *dev)
 Read from the Fault register. More...
 
int32_t ad5421_get_temp (struct ad5421_dev *dev)
 Read the temperature from Fault register. More...
 
float ad5421_get_vloop (struct ad5421_dev *dev)
 Read VLoop-COM from Fault register. More...
 
int32_t ad5421_set (struct ad5421_dev *dev, int32_t *value)
 Send data via SPI. More...
 
int32_t ad5421_get (struct ad5421_dev *dev)
 Read data via SPI. More...
 
void ad5421_reset (struct ad5421_dev *dev)
 Resets the ad5421 device. More...
 

Function Documentation

◆ ad5421_get()

int32_t ad5421_get ( struct ad5421_dev dev)

Read data via SPI.

Parameters
dev- The device structure.
Returns
returnVal - Data read
Here is the caller graph for this function:

◆ ad5421_get_dac()

int32_t ad5421_get_dac ( struct ad5421_dev dev)

Read from the DAC register.

Parameters
dev- The device structure.
Returns
dacValue - value read from the register.

◆ ad5421_get_fault()

int32_t ad5421_get_fault ( struct ad5421_dev dev)

Read from the Fault register.

Parameters
dev- The device structure.
Returns
value - register content

◆ ad5421_get_gain()

int32_t ad5421_get_gain ( struct ad5421_dev dev)

Read from the Gain Adjust register.

Parameters
dev- The device structure.
Returns
gainValue - value calculated according to the datasheet formula

◆ ad5421_get_offset()

int32_t ad5421_get_offset ( struct ad5421_dev dev)

Read from the Offset Adjust register.

Parameters
dev- The device structure.
Returns
offsetValue - value calculated according to the datasheet formula.

◆ ad5421_get_temp()

int32_t ad5421_get_temp ( struct ad5421_dev dev)

Read the temperature from Fault register.

Parameters
dev- The device structure.
Returns
tempValue - temperature value in Celsius degrees.

◆ ad5421_get_vloop()

float ad5421_get_vloop ( struct ad5421_dev dev)

Read VLoop-COM from Fault register.

Parameters
dev- The device structure.
Returns
vlopValue - value of the voltage drop between Vloop and COM.

◆ ad5421_init()

int32_t ad5421_init ( struct ad5421_dev **  device,
struct ad5421_init_param  init_param 
)

Initialize SPI and Initial Values for AD5421 Board.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
retValue - Result of the initialization. Example: 0 - if initialization was successful; -1 - if initialization was unsuccessful.

◆ ad5421_remove()

int32_t ad5421_remove ( struct ad5421_dev dev)

Free the resources allocated by ad5421_init().

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad5421_reset()

void ad5421_reset ( struct ad5421_dev dev)

Resets the ad5421 device.

Parameters
dev- The device structure.
Returns
None.

◆ ad5421_set()

int32_t ad5421_set ( struct ad5421_dev dev,
int32_t *  value 
)

Send data via SPI.

Parameters
dev- The device structure.
value- value to be sent via SPI
Returns
- Result of the initialization. Example: 0 - if initialization was successful; -1 - if initialization was unsuccessful.
Here is the caller graph for this function:

◆ ad5421_set_dac()

void ad5421_set_dac ( struct ad5421_dev dev,
int32_t  dac_value 
)

Write to the DAC register.

Parameters
dev- The device structure.
dac_value- desired value to be written in register.
Returns
None.

◆ ad5421_set_gain()

void ad5421_set_gain ( struct ad5421_dev dev,
int32_t  gain_value 
)

Write to the Gain Adjust register.

Parameters
dev- The device structure.
gain_value- desired value to be written in register.
Returns
None.

◆ ad5421_set_offset()

void ad5421_set_offset ( struct ad5421_dev dev,
int32_t  offset_value 
)

Write to the Offset Adjust register.

Parameters
dev- The device structure.
offset_value- desired value to be written in register.
Returns
None.