no-OS
ad7980.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __AD7980_H__
34 #define __AD7980_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdint.h>
40 #include "no_os_gpio.h"
41 #include "no_os_spi.h"
42 
43 /******************************************************************************/
44 /******************************** AD7980 **************************************/
45 /******************************************************************************/
46 /* AD74XX Chip Select Pin declaration */
47 #define AD7980_CS_LOW no_os_gpio_set_value(dev->gpio_cs, \
48  NO_OS_GPIO_LOW)
49 #define AD7980_CS_HIGH no_os_gpio_set_value(dev->gpio_cs, \
50  NO_OS_GPIO_HIGH)
51 
52 /******************************************************************************/
53 /*************************** Types Declarations *******************************/
54 /******************************************************************************/
55 
56 struct ad7980_dev {
57  /* SPI */
59  /* GPIO */
61 };
62 
64  /* SPI */
66  /* GPIO */
68 };
69 
70 /******************************************************************************/
71 /************************ Functions Declarations ******************************/
72 /******************************************************************************/
73 
75 int8_t ad7980_init(struct ad7980_dev **device,
77 
79 int32_t ad7980_remove(struct ad7980_dev *dev);
80 
82 uint16_t ad7980_conversion(struct ad7980_dev *dev);
83 
85 float ad7980_convert_to_volts(uint16_t raw_sample, float v_ref);
86 
87 #endif /* __AD7980_H__ */
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
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.
ad7980_remove
int32_t ad7980_remove(struct ad7980_dev *dev)
Free the resources allocated by ad7980_init().
Definition: ad7980.c:87
ad7980.h
Header file of AD7980 Driver.
ad7980_dev::gpio_cs
struct no_os_gpio_desc * gpio_cs
Definition: ad7980.h:60
device
Definition: ad9361_util.h:69
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
ad7980_conversion
uint16_t ad7980_conversion(struct ad7980_dev *dev)
Initiates conversion and reads data.
Definition: ad7980.c:107
ad7980_init
int8_t ad7980_init(struct ad7980_dev **device, struct ad7980_init_param init_param)
Initializes the communication peripheral.
Definition: ad7980.c:56
AD7980_CS_HIGH
#define AD7980_CS_HIGH
Definition: ad7980.h:49
ad7980_init
int8_t ad7980_init(struct ad7980_dev **device, struct ad7980_init_param init_param)
Initializes the communication peripheral.
Definition: ad7980.c:56
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:137
ad7980_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad7980.h:58
ad7980_remove
int32_t ad7980_remove(struct ad7980_dev *dev)
Free the resources allocated by ad7980_init().
Definition: ad7980.c:87
ad7980_dev
Definition: ad7980.h:56
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
ad7980_init_param
Definition: ad7980.h:63
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
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
ad7980_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ad7980.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
AD7980_CS_LOW
#define AD7980_CS_LOW
Definition: ad7980.h:47
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:67
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
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
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:137
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
ad7980_conversion
uint16_t ad7980_conversion(struct ad7980_dev *dev)
Initiates conversion and reads data.
Definition: ad7980.c:107