no-OS
ad7980.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef __AD7980_H__
40 #define __AD7980_H__
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 #include "no_os_gpio.h"
47 #include "no_os_spi.h"
48 
49 /******************************************************************************/
50 /******************************** AD7980 **************************************/
51 /******************************************************************************/
52 /* AD74XX Chip Select Pin declaration */
53 #define AD7980_CS_LOW no_os_gpio_set_value(dev->gpio_cs, \
54  NO_OS_GPIO_LOW)
55 #define AD7980_CS_HIGH no_os_gpio_set_value(dev->gpio_cs, \
56  NO_OS_GPIO_HIGH)
57 
58 /******************************************************************************/
59 /*************************** Types Declarations *******************************/
60 /******************************************************************************/
61 
62 struct ad7980_dev {
63  /* SPI */
65  /* GPIO */
67 };
68 
70  /* SPI */
72  /* GPIO */
74 };
75 
76 /******************************************************************************/
77 /************************ Functions Declarations ******************************/
78 /******************************************************************************/
79 
81 int8_t ad7980_init(struct ad7980_dev **device,
83 
85 int32_t ad7980_remove(struct ad7980_dev *dev);
86 
88 uint16_t ad7980_conversion(struct ad7980_dev *dev);
89 
91 float ad7980_convert_to_volts(uint16_t raw_sample, float v_ref);
92 
93 #endif /* __AD7980_H__ */
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
ad7980_init_param::spi_init
no_os_spi_init_param spi_init
Definition: ad7980.h:71
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.
ad7980_remove
int32_t ad7980_remove(struct ad7980_dev *dev)
Free the resources allocated by ad7980_init().
Definition: ad7980.c:92
ad7980.h
Header file of AD7980 Driver.
ad7980_dev::gpio_cs
struct no_os_gpio_desc * gpio_cs
Definition: ad7980.h:66
device
Definition: ad9361_util.h:75
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
ad7980_conversion
uint16_t ad7980_conversion(struct ad7980_dev *dev)
Initiates conversion and reads data.
Definition: ad7980.c:112
ad7980_init
int8_t ad7980_init(struct ad7980_dev **device, struct ad7980_init_param init_param)
Initializes the communication peripheral.
Definition: ad7980.c:61
AD7980_CS_HIGH
#define AD7980_CS_HIGH
Definition: ad7980.h:55
ad7980_init
int8_t ad7980_init(struct ad7980_dev **device, struct ad7980_init_param init_param)
Initializes the communication peripheral.
Definition: ad7980.c:61
ad7980_convert_to_volts
float ad7980_convert_to_volts(uint16_t raw_sample, float v_ref)
Converts a 16-bit raw sample to volts.
Definition: ad7980.c:142
ad7980_remove
int32_t ad7980_remove(struct ad7980_dev *dev)
Free the resources allocated by ad7980_init().
Definition: ad7980.c:92
ad7980_dev
Definition: ad7980.h:62
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
ad7980_init_param
Definition: ad7980.h:69
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
ad7980_dev::spi_desc
no_os_spi_desc * spi_desc
Definition: ad7980.h:64
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
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
AD7980_CS_LOW
#define AD7980_CS_LOW
Definition: ad7980.h:53
no_os_gpio.h
Header file of GPIO Interface.
ad7980_init_param::gpio_cs
struct no_os_gpio_init_param gpio_cs
Definition: ad7980.h:73
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
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
ad7980_convert_to_volts
float ad7980_convert_to_volts(uint16_t raw_sample, float v_ref)
Converts a 16-bit raw sample to volts.
Definition: ad7980.c:142
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:112
ad7980_conversion
uint16_t ad7980_conversion(struct ad7980_dev *dev)
Initiates conversion and reads data.
Definition: ad7980.c:112