no-OS
ad74xx.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef __AD74XX_H__
41 #define __AD74XX_H__
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 #include <stdint.h>
47 #include "no_os_spi.h"
48 #include "no_os_gpio.h"
49 
50 /******************************************************************************/
51 /******************************** AD74XX **************************************/
52 /******************************************************************************/
53 
54 /* AD74XX Chip Select Pin declaration */
55 #define AD74XX_CS_LOW no_os_gpio_set_value(dev->gpio_cs, \
56  NO_OS_GPIO_LOW)
57 #define AD74XX_CS_HIGH no_os_gpio_set_value(dev->gpio_cs, \
58  NO_OS_GPIO_HIGH)
59 
60 /******************************************************************************/
61 /*************************** Types Declarations *******************************/
62 /******************************************************************************/
63 
64 /* Supported devices */
66  ID_AD7466 = 12,
67  ID_AD7467 = 10,
68  ID_AD7468 = 8,
69  ID_AD7475 = 12,
70  ID_AD7476 = 12,
71  ID_AD7476A = 12,
72  ID_AD7477 = 10,
73  ID_AD7477A = 10,
74  ID_AD7478 = 8,
76  ID_AD7495 = 12
77 };
78 
79 struct ad74xx_dev {
80  /* SPI */
82  /* GPIO */
84  /* Device Settings */
87 };
88 
90  /* SPI */
92  /* GPIO */
94  /* Device Settings */
97 };
98 
99 /******************************************************************************/
100 /************************ Functions Declarations ******************************/
101 /******************************************************************************/
102 
104 int8_t ad74xx_init(struct ad74xx_dev **device,
106 
108 int32_t ad74xx_remove(struct ad74xx_dev *dev);
109 
111 void ad74xx_power_down(struct ad74xx_dev *dev);
112 
114 void ad74xx_power_up(struct ad74xx_dev *dev);
115 
117 uint16_t ad74xx_get_register_value(struct ad74xx_dev *dev);
118 
120 float ad74xx_convert_to_volts(struct ad74xx_dev *dev,
121  uint16_t raw_value,
122  float v_ref);
123 
124 #endif /* __AD74XX_H__ */
ad74xx_init_param
Definition: ad74xx.h:89
ad74xx_power_up
void ad74xx_power_up(struct ad74xx_dev *dev)
Powers up the device by performing a dummy read. This function is supported only by: AD7475(partial p...
Definition: ad74xx.c:141
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
ad74xx_dev
Definition: ad74xx.h:79
ID_AD7478A
@ ID_AD7478A
Definition: ad74xx.h:75
ad74xx_remove
int32_t ad74xx_remove(struct ad74xx_dev *dev)
Free the resources allocated by ad74xx_init().
Definition: ad74xx.c:99
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:82
no_os_spi.h
Header file of SPI Interface.
ID_AD7467
@ ID_AD7467
Definition: ad74xx.h:67
ad74xx_get_register_value
uint16_t ad74xx_get_register_value(struct ad74xx_dev *dev)
Reads the conversion value.
Definition: ad74xx.c:155
ad74xx_remove
int32_t ad74xx_remove(struct ad74xx_dev *dev)
Free the resources allocated by ad74xx_init().
Definition: ad74xx.c:99
ad74xx_convert_to_volts
float ad74xx_convert_to_volts(struct ad74xx_dev *dev, uint16_t raw_value, float v_ref)
Converts a raw sample to volts.
Definition: ad74xx.c:195
ad74xx_power_up
void ad74xx_power_up(struct ad74xx_dev *dev)
Powers up the device by performing a dummy read. This function is supported only by: AD7475(partial p...
Definition: ad74xx.c:141
AD74XX_CS_HIGH
#define AD74XX_CS_HIGH
Definition: ad74xx.h:57
ID_AD7477
@ ID_AD7477
Definition: ad74xx.h:72
ad74xx_init_param::device_bits_number
int8_t device_bits_number
Definition: ad74xx.h:95
device
Definition: ad9361_util.h:75
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
ad74xx_dev::spi_desc
no_os_spi_desc * spi_desc
Definition: ad74xx.h:81
ad74xx_convert_to_volts
float ad74xx_convert_to_volts(struct ad74xx_dev *dev, uint16_t raw_value, float v_ref)
Converts a raw sample to volts.
Definition: ad74xx.c:195
ad74xx_dev::part_number
enum ad74xx_type part_number
Definition: ad74xx.h:86
ID_AD7466
@ ID_AD7466
Definition: ad74xx.h:66
AD74XX_CS_LOW
#define AD74XX_CS_LOW
Definition: ad74xx.h:55
ID_AD7476
@ ID_AD7476
Definition: ad74xx.h:70
ad74xx_init
int8_t ad74xx_init(struct ad74xx_dev **device, struct ad74xx_init_param init_param)
Initializes the communication peripheral and the initial Values for AD74xx Board.
Definition: ad74xx.c:64
ID_AD7477A
@ ID_AD7477A
Definition: ad74xx.h:73
ID_AD7495
@ ID_AD7495
Definition: ad74xx.h:76
ad74xx_init
int8_t ad74xx_init(struct ad74xx_dev **device, struct ad74xx_init_param init_param)
Initializes the communication peripheral and the initial Values for AD74xx Board.
Definition: ad74xx.c:64
ad74xx.h
Header file of AD74xx Driver.
ad74xx_init_param::part_number
enum ad74xx_type part_number
Definition: ad74xx.h:96
ID_AD7478
@ ID_AD7478
Definition: ad74xx.h:74
ad74xx_init_param::gpio_cs
struct no_os_gpio_init_param gpio_cs
Definition: ad74xx.h:93
ad74xx_power_down
void ad74xx_power_down(struct ad74xx_dev *dev)
Powers down the device. This function is supported only by: AD7475(partial power down),...
Definition: ad74xx.c:121
ID_AD7475
@ ID_AD7475
Definition: ad74xx.h:69
ad74xx_type
ad74xx_type
Definition: ad74xx.h:65
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:95
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:132
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
ID_AD7468
@ ID_AD7468
Definition: ad74xx.h:68
no_os_gpio_get
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:55
ad74xx_power_down
void ad74xx_power_down(struct ad74xx_dev *dev)
Powers down the device. This function is supported only by: AD7475(partial power down),...
Definition: ad74xx.c:121
ID_AD7476A
@ ID_AD7476A
Definition: ad74xx.h:71
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
ad74xx_init_param::spi_init
no_os_spi_init_param spi_init
Definition: ad74xx.h:91
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:70
no_os_gpio.h
Header file of GPIO Interface.
ad74xx_dev::gpio_cs
struct no_os_gpio_desc * gpio_cs
Definition: ad74xx.h:83
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:51
ad74xx_dev::device_bits_number
int8_t device_bits_number
Definition: ad74xx.h:85
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:124
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:112
ad74xx_get_register_value
uint16_t ad74xx_get_register_value(struct ad74xx_dev *dev)
Reads the conversion value.
Definition: ad74xx.c:155