no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Functions
ad5293.c File Reference
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "ad5293.h"
#include "no_os_alloc.h"
#include "no_os_delay.h"
Include dependency graph for ad5293.c:

Functions

int32_t ad5293_init (struct ad5293_dev **device, struct ad5293_init_param *init_param)
 Initialize the ad5293 device structure. More...
 
int32_t ad5293_remove (struct ad5293_dev *dev)
 Free any resource used by the driver. More...
 
int32_t ad5293_hard_reset (struct ad5293_dev *dev)
 Reset ad5293 through Hardware Reset Pin. More...
 
int32_t ad5293_soft_reset (struct ad5293_dev *dev)
 Reset ad5293 through software reset command. More...
 
int32_t ad5293_sdo_setfloat (struct ad5293_dev *dev)
 Place SDO pin in high impedence mode. More...
 
int32_t ad5293_shutdown (struct ad5293_dev *dev, enum shutdown_t sd)
 Place ad5293 in shutdown mode or recovery. More...
 
int32_t ad5293_update_cali (struct ad5293_dev *dev, enum calibration_mode_t cali, uint8_t num)
 Update ad5293 chip info struct calibration information. More...
 
int32_t ad5293_update_wiper (struct ad5293_dev *dev, uint16_t val, uint8_t num)
 Update ad5293 chip info struct wiper value information. More...
 
int32_t ad5293_write_cali (struct ad5293_dev *dev)
 Write ad5293 chip info struct calibration value through SPI interface. More...
 
int32_t ad5293_write_wiper (struct ad5293_dev *dev)
 Write ad5293 chip info struct wiper value through SPI interface. More...
 
int32_t ad5293_read_reg_cali (struct ad5293_dev *dev)
 Read ad5293 device register calibration mode through SPI interface. More...
 
int32_t ad5293_read_reg_wiper (struct ad5293_dev *dev)
 Read ad5293 device register wiper value through SPI interface. More...
 
int8_t ad5293_get_cali (struct ad5293_dev *dev, uint8_t num)
 Get calibration of a certain chip. More...
 
int16_t ad5293_get_wiper (struct ad5293_dev *dev, uint8_t num)
 Get wiper of a certain chip. More...
 

Function Documentation

◆ ad5293_get_cali()

int8_t ad5293_get_cali ( struct ad5293_dev dev,
uint8_t  num 
)

Get calibration of a certain chip.

return chip info struct calibration value to caller.

Parameters
dev- The device structure.
num- The device number.( 0 to chip_num-1)
Returns
ret - return code. Example: -EINVAL - No valid chip selected. 0 - No errors encountered.

◆ ad5293_get_wiper()

int16_t ad5293_get_wiper ( struct ad5293_dev dev,
uint8_t  num 
)

Get wiper of a certain chip.

return chip info struct wiper value to caller.

Parameters
dev- The device structure.
num- The device number.( 0 to chip_num-1)
Returns
ret - return code. Example: -EINVAL - No valid chip selected. 0 - No errors encountered.

◆ ad5293_hard_reset()

int32_t ad5293_hard_reset ( struct ad5293_dev dev)

Reset ad5293 through Hardware Reset Pin.

Parameters
dev- The device structure.
Returns
ret - return code. Example: -EINVAL - No valid pointer input. -ENOSYS - No valid operation. 0 - No errors encountered.
Here is the caller graph for this function:

◆ ad5293_init()

int32_t ad5293_init ( struct ad5293_dev **  device,
struct ad5293_init_param init_param 
)

Initialize the ad5293 device structure.

Performs memory allocation of the device structure.

Parameters
device- Pointer to location of device structure to write.
init_param- Pointer to configuration of the driver.
Returns
ret - return code. Example: -ENOMEM - Memory allocation error. -EINVAL - No GPIO instance. -EINVAL - No valid chip number. -EIO - SPI communication error. -EIO - GPIO initialization error. 0 - No errors encountered.

◆ ad5293_read_reg_cali()

int32_t ad5293_read_reg_cali ( struct ad5293_dev dev)

Read ad5293 device register calibration mode through SPI interface.

read ad5293 calibration value and update it to chip info struct. Note: multiple chips operation should in daisy-chain mode.

Parameters
dev- The device structure.
Returns
ret - return code. Example: -EINVAL - No valid pointer input. -ENOSYS - No valid operation. 0 - No errors encountered.

◆ ad5293_read_reg_wiper()

int32_t ad5293_read_reg_wiper ( struct ad5293_dev dev)

Read ad5293 device register wiper value through SPI interface.

read ad5293 wiper value and update it to chip info struct. Note: multiple chips operation should in daisy-chain mode.

Parameters
dev- The device structure.
Returns
ret - return code. Example: -EINVAL - No valid pointer input. -ENOSYS - No valid operation. 0 - No errors encountered.

◆ ad5293_remove()

int32_t ad5293_remove ( struct ad5293_dev dev)

Free any resource used by the driver.

Parameters
dev- The device structure.
Returns
ret - return code. Example: -EINVAL - No valid pointer input. -ENOSYS - No valid operation. 0 - No errors encountered.

◆ ad5293_sdo_setfloat()

int32_t ad5293_sdo_setfloat ( struct ad5293_dev dev)

Place SDO pin in high impedence mode.

Minimize power dissipation when pin is used.

Parameters
dev- The device structure.
Returns
ret - return code. Example: -EINVAL - No valid pointer input. -ENOSYS - No valid operation. 0 - No errors encountered.

◆ ad5293_shutdown()

int32_t ad5293_shutdown ( struct ad5293_dev dev,
enum shutdown_t  sd 
)

Place ad5293 in shutdown mode or recovery.

In shut down mode, terminal A open, Wiper and terminal B connected.

Parameters
dev- The device structure.
sd- shutdown mode selection.
Returns
ret - return code. Example: -EINVAL - No valid pointer input. -ENOSYS - No valid operation. 0 - No errors encountered.

◆ ad5293_soft_reset()

int32_t ad5293_soft_reset ( struct ad5293_dev dev)

Reset ad5293 through software reset command.

Parameters
dev- The device structure.
Returns
ret - return code. Example: -EINVAL - No valid pointer input. -ENOSYS - No valid operation. 0 - No errors encountered.

◆ ad5293_update_cali()

int32_t ad5293_update_cali ( struct ad5293_dev dev,
enum calibration_mode_t  cali,
uint8_t  num 
)

Update ad5293 chip info struct calibration information.

For calibration register write operation.

Parameters
dev- The device structure.
cali- calibration mode selection.
num- chip indication.
Returns
ret - return code. Example: -EINVAL - No valid num input. 0 - No errors encountered.

◆ ad5293_update_wiper()

int32_t ad5293_update_wiper ( struct ad5293_dev dev,
uint16_t  val,
uint8_t  num 
)

Update ad5293 chip info struct wiper value information.

For wiper register write operation.

Parameters
dev- The device structure.
val- wiper value.
num- chip indication.
Returns
ret - return code. Example: -EINVAL - No valid num input. 0 - No errors encountered.

◆ ad5293_write_cali()

int32_t ad5293_write_cali ( struct ad5293_dev dev)

Write ad5293 chip info struct calibration value through SPI interface.

Note: multiple chips operation should in daisy-chain mode.

Parameters
dev- The device structure.
Returns
ret - return code. Example: -EINVAL - No valid pointer input. -ENOSYS - No valid operation. 0 - No errors encountered.

◆ ad5293_write_wiper()

int32_t ad5293_write_wiper ( struct ad5293_dev dev)

Write ad5293 chip info struct wiper value through SPI interface.

Note: multiple chips operation should in daisy-chain mode.

Parameters
dev- The device structure.
Returns
ret - return code. Example: -EINVAL - No valid pointer input. -ENOSYS - No valid operation. 0 - No errors encountered.