no-OS
ad74xx.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef __AD74XX_H__
35 #define __AD74XX_H__
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 #include <stdint.h>
41 #include "no_os_spi.h"
42 #include "no_os_gpio.h"
43 
44 /******************************************************************************/
45 /******************************** AD74XX **************************************/
46 /******************************************************************************/
47 
48 /* AD74XX Chip Select Pin declaration */
49 #define AD74XX_CS_LOW no_os_gpio_set_value(dev->gpio_cs, \
50  NO_OS_GPIO_LOW)
51 #define AD74XX_CS_HIGH no_os_gpio_set_value(dev->gpio_cs, \
52  NO_OS_GPIO_HIGH)
53 
54 /******************************************************************************/
55 /*************************** Types Declarations *******************************/
56 /******************************************************************************/
57 
58 /* Supported devices */
60  ID_AD7466 = 12,
61  ID_AD7467 = 10,
62  ID_AD7468 = 8,
63  ID_AD7475 = 12,
64  ID_AD7476 = 12,
65  ID_AD7476A = 12,
66  ID_AD7477 = 10,
67  ID_AD7477A = 10,
68  ID_AD7478 = 8,
70  ID_AD7495 = 12
71 };
72 
73 struct ad74xx_dev {
74  /* SPI */
76  /* GPIO */
78  /* Device Settings */
81 };
82 
84  /* SPI */
86  /* GPIO */
88  /* Device Settings */
91 };
92 
93 /******************************************************************************/
94 /************************ Functions Declarations ******************************/
95 /******************************************************************************/
96 
98 int8_t ad74xx_init(struct ad74xx_dev **device,
100 
102 int32_t ad74xx_remove(struct ad74xx_dev *dev);
103 
105 void ad74xx_power_down(struct ad74xx_dev *dev);
106 
108 void ad74xx_power_up(struct ad74xx_dev *dev);
109 
111 uint16_t ad74xx_get_register_value(struct ad74xx_dev *dev);
112 
114 float ad74xx_convert_to_volts(struct ad74xx_dev *dev,
115  uint16_t raw_value,
116  float v_ref);
117 
118 #endif /* __AD74XX_H__ */
ad74xx_init_param
Definition: ad74xx.h:83
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:136
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
ad74xx_dev
Definition: ad74xx.h:73
ID_AD7478A
@ ID_AD7478A
Definition: ad74xx.h:69
ad74xx_remove
int32_t ad74xx_remove(struct ad74xx_dev *dev)
Free the resources allocated by ad74xx_init().
Definition: ad74xx.c:94
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:159
no_os_spi.h
Header file of SPI Interface.
ID_AD7467
@ ID_AD7467
Definition: ad74xx.h:61
ad74xx_get_register_value
uint16_t ad74xx_get_register_value(struct ad74xx_dev *dev)
Reads the conversion value.
Definition: ad74xx.c:150
ad74xx_remove
int32_t ad74xx_remove(struct ad74xx_dev *dev)
Free the resources allocated by ad74xx_init().
Definition: ad74xx.c:94
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:190
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:136
AD74XX_CS_HIGH
#define AD74XX_CS_HIGH
Definition: ad74xx.h:51
ID_AD7477
@ ID_AD7477
Definition: ad74xx.h:66
ad74xx_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ad74xx.h:85
ad74xx_init_param::device_bits_number
int8_t device_bits_number
Definition: ad74xx.h:89
device
Definition: ad9361_util.h:69
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
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:190
ad74xx_dev::part_number
enum ad74xx_type part_number
Definition: ad74xx.h:80
ID_AD7466
@ ID_AD7466
Definition: ad74xx.h:60
AD74XX_CS_LOW
#define AD74XX_CS_LOW
Definition: ad74xx.h:49
ID_AD7476
@ ID_AD7476
Definition: ad74xx.h:64
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:59
ID_AD7477A
@ ID_AD7477A
Definition: ad74xx.h:67
ID_AD7495
@ ID_AD7495
Definition: ad74xx.h:70
ad74xx_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad74xx.h:75
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:59
ad74xx.h
Header file of AD74xx Driver.
ad74xx_init_param::part_number
enum ad74xx_type part_number
Definition: ad74xx.h:90
ID_AD7478
@ ID_AD7478
Definition: ad74xx.h:68
ad74xx_init_param::gpio_cs
struct no_os_gpio_init_param gpio_cs
Definition: ad74xx.h:87
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:116
ID_AD7475
@ ID_AD7475
Definition: ad74xx.h:63
ad74xx_type
ad74xx_type
Definition: ad74xx.h:59
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:104
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
ID_AD7468
@ ID_AD7468
Definition: ad74xx.h:62
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:49
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
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:116
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
ID_AD7476A
@ ID_AD7476A
Definition: ad74xx.h:65
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
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:116
no_os_gpio.h
Header file of GPIO Interface.
ad74xx_dev::gpio_cs
struct no_os_gpio_desc * gpio_cs
Definition: ad74xx.h:77
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:52
ad74xx_dev::device_bits_number
int8_t device_bits_number
Definition: ad74xx.h:79
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:147
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
ad74xx_get_register_value
uint16_t ad74xx_get_register_value(struct ad74xx_dev *dev)
Reads the conversion value.
Definition: ad74xx.c:150