no-OS
ad799x.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef __AD799X_H__
41 #define __AD799X_H__
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 #include <stdint.h>
47 #include "no_os_i2c.h"
48 
49 /******************************************************************************/
50 /******************************** AD799x **************************************/
51 /******************************************************************************/
52 
53 /* Configuration Register definition. */
54 #define AD799X_CHANNEL(ch) ((1 << ch) << 4)
55 #define AD799X_REF_SEL (1 << 3)
56 #define AD799X_FLTR (1 << 2)
57 #define AD799X_BIT_TRIAL_DELAY (1 << 1)
58 #define AD799X_SAMPLE_DELAY (1 << 0)
59 
60 /******************************************************************************/
61 /*************************** Types Declarations *******************************/
62 /******************************************************************************/
63 
64 /* Supported devices */
69 };
70 
71 struct ad799x_dev {
72  /* I2C */
74  /* Device Settings */
75  uint8_t bits_number;
76 };
77 
79  /* I2C */
81  /* Device Settings */
83 };
84 
85 /******************************************************************************/
86 /************************ Functions Declarations ******************************/
87 /******************************************************************************/
88 
90 int8_t ad799x_init(struct ad799x_dev **device,
92 
94 int32_t ad799x_remove(struct ad799x_dev *dev);
95 
98  uint8_t register_value);
99 
102  int16_t* conv_value,
103  int8_t* channel);
104 
106 float ad799x_convert_to_volts(struct ad799x_dev *dev,
107  int16_t raw_sample,
108  float v_ref);
109 
110 #endif /* __AD799X_H__ */
AD7995
@ AD7995
Definition: ad799x.h:67
no_os_alloc.h
no_os_i2c_write
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:165
no_os_i2c_init
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:58
ad799x_convert_to_volts
float ad799x_convert_to_volts(struct ad799x_dev *dev, int16_t raw_sample, float v_ref)
Converts a raw sample to volts.
Definition: ad799x.c:156
no_os_i2c_remove
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:119
ad799x_init_param
Definition: ad799x.h:78
ad799x_dev::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: ad799x.h:73
device
Definition: ad9361_util.h:75
ad799x_init_param::part_number
enum ad799x_type part_number
Definition: ad799x.h:82
ad799x_remove
int32_t ad799x_remove(struct ad799x_dev *dev)
Free the resources allocated by ad799x_init().
Definition: ad799x.c:100
ad799x.h
Header file of AD799x Driver.
ad799x_init_param::i2c_init
struct no_os_i2c_init_param i2c_init
Definition: ad799x.h:80
ad799x_set_configuration_reg
void ad799x_set_configuration_reg(struct ad799x_dev *dev, uint8_t register_value)
Writes data into the Configuration Register.
Definition: ad799x.c:119
ad799x_convert_to_volts
float ad799x_convert_to_volts(struct ad799x_dev *dev, int16_t raw_sample, float v_ref)
Converts a raw sample to volts.
Definition: ad799x.c:156
ad799x_set_configuration_reg
void ad799x_set_configuration_reg(struct ad799x_dev *dev, uint8_t register_value)
Writes data into the Configuration Register.
Definition: ad799x.c:119
ad799x_init
int8_t ad799x_init(struct ad799x_dev **device, struct ad799x_init_param init_param)
Initializes I2C.
Definition: ad799x.c:62
ad799x_dev::bits_number
uint8_t bits_number
Definition: ad799x.h:75
ad799x_dev
Definition: ad799x.h:71
ad799x_get_conversion_result
void ad799x_get_conversion_result(struct ad799x_dev *dev, int16_t *conv_value, int8_t *channel)
Reads the High byte and the Low byte of the conversion.
Definition: ad799x.c:134
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:107
no_os_i2c_read
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:196
AD7999
@ AD7999
Definition: ad799x.h:68
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:49
no_os_i2c.h
Header file of I2C Interface.
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:75
ad799x_type
ad799x_type
Definition: ad799x.h:65
AD7991
@ AD7991
Definition: ad799x.h:66
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:70
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
ad799x_get_conversion_result
void ad799x_get_conversion_result(struct ad799x_dev *dev, int16_t *conv_value, int8_t *channel)
Reads the High byte and the Low byte of the conversion.
Definition: ad799x.c:134
ad799x_init
int8_t ad799x_init(struct ad799x_dev **device, struct ad799x_init_param init_param)
Initializes I2C.
Definition: ad799x.c:62
ad799x_remove
int32_t ad799x_remove(struct ad799x_dev *dev)
Free the resources allocated by ad799x_init().
Definition: ad799x.c:100