no-OS
ad7768.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef AD7768_H_
34 #define AD7768_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 /********************** Macros and Constants Definitions **********************/
45 /******************************************************************************/
46 #define AD7768_REG_CH_STANDBY 0x00
47 #define AD7768_REG_CH_MODE_A 0x01
48 #define AD7768_REG_CH_MODE_B 0x02
49 #define AD7768_REG_CH_MODE_SEL 0x03
50 #define AD7768_REG_PWR_MODE 0x04
51 #define AD7768_REG_GENERAL_CFG 0x05
52 #define AD7768_REG_DATA_CTRL 0x06
53 #define AD7768_REG_INTERFACE_CFG 0x07
54 #define AD7768_REG_BIST_CTRL 0x08
55 #define AD7768_REG_DEV_STATUS 0x09
56 #define AD7768_REG_REV_ID 0x0A
57 #define AD7768_REG_DEV_ID_MSB 0x0B
58 #define AD7768_REG_DEV_ID_LSB 0x0C
59 #define AD7768_REG_SW_REV_ID 0x0D
60 #define AD7768_REG_GPIO_CTRL 0x0E
61 #define AD7768_REG_GPIO_WR_DATA 0x0F
62 #define AD7768_REG_GPIO_RD_DATA 0x10
63 #define AD7768_REG_PRECHARGE_BUF_1 0x11
64 #define AD7768_REG_PRECHARGE_BUF_2 0x12
65 #define AD7768_REG_POS_REF_BUF 0x13
66 #define AD7768_REG_NEG_REF_BUF 0x14
67 #define AD7768_REG_CH_OFFSET_1(ch) (0x1E + (ch) * 3)
68 #define AD7768_REG_CH_OFFSET_2(ch) (0x1F + (ch) * 3)
69 #define AD7768_REG_CH_OFFSET_3(ch) (0x20 + (ch) * 3)
70 #define AD7768_REG_CH_GAIN_1(ch) (0x36 + (ch) * 3)
71 #define AD7768_REG_CH_GAIN_2(ch) (0x37 + (ch) * 3)
72 #define AD7768_REG_CH_GAIN_3(ch) (0x38 + (ch) * 3)
73 #define AD7768_REG_CH_SYNC_OFFSET(ch) (0x4E + (ch) * 3)
74 #define AD7768_REG_DIAG_METER_RX 0x56
75 #define AD7768_REG_DIAG_CTRL 0x57
76 #define AD7768_REG_DIAG_MOD_DELAY_CTRL 0x58
77 #define AD7768_REG_DIAG_CHOP_CTRL 0x59
78 
79 /* AD7768_REG_CH_STANDBY */
80 #define AD7768_CH_STANDBY(x) (1 << (x))
81 
82 /* AD7768_REG_CH_MODE_x */
83 #define AD7768_CH_MODE_FILTER_TYPE (1 << 3)
84 #define AD7768_CH_MODE_DEC_RATE_MSK NO_OS_GENMASK(2, 0)
85 #define AD7768_CH_MODE_DEC_RATE(x) (((x) & 0x7) << 0)
86 
87 /* AD7768_REG_CH_MODE_SEL */
88 #define AD7768_CH_MODE(x) (1 << (x))
89 
90 /* AD7768_REG_PWR_MODE */
91 #define AD7768_PWR_MODE_POWER_MODE_MSK NO_OS_GENMASK(5, 4)
92 #define AD7768_PWR_MODE_SLEEP_MODE (1 << 7)
93 #define AD7768_PWR_MODE_POWER_MODE(x) (((x) & 0x3) << 4)
94 #define AD7768_PWR_MODE_LVDS_ENABLE (1 << 3)
95 #define AD7768_PWR_MODE_MCLK_DIV_MSK NO_OS_GENMASK(1, 0)
96 #define AD7768_PWR_MODE_MCLK_DIV(x) (((x) & 0x3) << 0)
97 #define ad7768_map_power_mode_to_regval(x) ((x) ? ((x) + 1) : 0)
98 
99 /* AD7768_REG_DATA_CTRL */
100 #define AD7768_DATA_CTRL_SPI_SYNC (1 << 7)
101 #define AD7768_DATA_CTRL_SINGLE_SHOT_EN (1 << 4)
102 #define AD7768_DATA_CTRL_SPI_RESET(x) (((x) & 0x3) << 0)
103 #define AD7768_DATA_CONTROL_SPI_SYNC_MSK NO_OS_BIT(7)
104 #define AD7768_DATA_CONTROL_SPI_SYNC NO_OS_BIT(7)
105 #define AD7768_DATA_CONTROL_SPI_SYNC_CLEAR 0
106 
107 /* AD7768_REG_INTERFACE_CFG */
108 #define AD7768_INTERFACE_CFG_CRC_SEL(x) (((x) & 0x3) << 2)
109 #define AD7768_INTERFACE_CFG_DCLK_DIV(x) (((x) & 0x3) << 0)
110 #define AD7768_INTERFACE_CFG_DCLK_DIV_MSK NO_OS_GENMASK(1, 0)
111 #define AD7768_INTERFACE_CFG_DCLK_DIV_MODE(x) (4 - no_os_find_first_set_bit(x))
112 #define AD7768_MAX_DCLK_DIV 8
113 
114 #define AD7768_RESOLUTION 24
115 #define AD7768_SAMPLE_SIZE 32
116 #define AD7768_MAX_FREQ_PER_MODE 6
117 #define AD7768_NUM_CHANNELS 8
118 
119 /******************************************************************************/
120 /*************************** Types Declarations *******************************/
121 /******************************************************************************/
122 typedef enum {
126 
127 typedef enum {
132 
138 };
139 
140 typedef enum {
145 
146 typedef enum {
152 
153 typedef enum {
157 
158 typedef enum {
162 
163 typedef enum {
169 
170 typedef enum {
180 } ad7768_ch;
181 
182 typedef enum {
186 
187 typedef enum {
191 
192 typedef enum {
196 
197 typedef enum {
207 
208 static const int ad7768_dec_rate_vals[6] = {
209  32, 64, 128, 256, 512, 1024
210 };
211 
212 static const int ad7768_mclk_div_vals[3] = {
213  32, 8, 4
214 };
215 
217  unsigned int freq;
218  unsigned int dec_rate;
219 };
220 
222  unsigned int n_freqs;
224 };
225 
226 typedef struct {
238  enum ad7768_power_modes_raw power_mode_raw;
243  ad7768_ch_state ch_state[8];
244  ad7768_ch_mode ch_mode[8];
245  ad7768_filt_type filt_type[2];
247  unsigned int mclk;
248  unsigned int datalines;
249  unsigned int sampling_freq;
251 } ad7768_dev;
252 
253 typedef struct {
254  /* SPI */
256  /* GPIO */
257  struct no_os_gpio_init_param gpio_reset;
259  struct no_os_gpio_init_param gpio_mode0;
260  struct no_os_gpio_init_param gpio_mode1;
261  struct no_os_gpio_init_param gpio_mode2;
262  struct no_os_gpio_init_param gpio_mode3;
263  /* Configuration */
271  unsigned int mclk;
272  unsigned int datalines;
274 
275 /******************************************************************************/
276 /************************ Functions Declarations ******************************/
277 /******************************************************************************/
278 /* SPI read from device. */
279 int32_t ad7768_spi_read(ad7768_dev *dev,
280  uint8_t reg_addr,
281  uint8_t *reg_data);
282 /* SPI write to device. */
283 int32_t ad7768_spi_write(ad7768_dev *dev,
284  uint8_t reg_addr,
285  uint8_t reg_data);
286 /* SPI read from device using a mask. */
287 int32_t ad7768_spi_read_mask(ad7768_dev *dev,
288  uint8_t reg_addr,
289  uint8_t mask,
290  uint8_t *data);
291 /* SPI write to device using a mask. */
292 int32_t ad7768_spi_write_mask(ad7768_dev *dev,
293  uint8_t reg_addr,
294  uint8_t mask,
295  uint8_t data);
296 /* Set the device sleep mode. */
297 int32_t ad7768_set_sleep_mode(ad7768_dev *dev,
298  ad7768_sleep_mode mode);
299 /* Get the device sleep mode. */
300 int32_t ad7768_get_sleep_mode(ad7768_dev *dev,
301  ad7768_sleep_mode *mode);
302 /* Set the device power mode. */
303 int32_t ad7768_set_power_mode(ad7768_dev *dev,
304  ad7768_power_mode mode);
305 /* Get the device power mode. */
306 int32_t ad7768_get_power_mode(ad7768_dev *dev,
307  ad7768_power_mode *mode);
308 /* Set the MCLK divider. */
309 int32_t ad7768_set_mclk_div(ad7768_dev *dev,
310  ad7768_mclk_div clk_div);
311 /* Get the MCLK divider. */
312 int32_t ad7768_get_mclk_div(ad7768_dev *dev,
313  ad7768_mclk_div *clk_div);
314 /* Set the DCLK divider. */
315 int32_t ad7768_set_dclk_div(ad7768_dev *dev,
316  ad7768_dclk_div clk_div);
317 /* Get the DCLK divider. */
318 int32_t ad7768_get_dclk_div(ad7768_dev *dev,
319  ad7768_dclk_div *clk_div);
320 /* Set the conversion operation mode. */
321 int32_t ad7768_set_conv_op(ad7768_dev *dev,
322  ad7768_conv_op conv_op);
323 /* Get the conversion operation mode. */
324 int32_t ad7768_get_conv_op(ad7768_dev *dev,
325  ad7768_conv_op *conv_op);
326 /* Set the CRC selection. */
327 int32_t ad7768_set_crc_sel(ad7768_dev *dev,
328  ad7768_crc_sel crc_sel);
329 /* Get the CRC selection. */
330 int32_t ad7768_get_crc_sel(ad7768_dev *dev,
331  ad7768_crc_sel *crc_sel);
332 /* Set the channel state. */
333 int32_t ad7768_set_ch_state(ad7768_dev *dev,
334  ad7768_ch ch,
335  ad7768_ch_state state);
336 /* Get the channel state. */
337 int32_t ad7768_get_ch_state(ad7768_dev *dev,
338  ad7768_ch ch,
339  ad7768_ch_state *state);
340 /* Set the mode configuration. */
342  ad7768_ch_mode mode,
343  ad7768_filt_type filt_type,
344  ad7768_dec_rate dec_rate);
345 /* Get the mode configuration. */
347  ad7768_ch_mode mode,
348  ad7768_filt_type *filt_type,
349  ad7768_dec_rate *dec_rate);
350 /* Set the channel mode. */
351 int32_t ad7768_set_ch_mode(ad7768_dev *dev,
352  ad7768_ch ch,
353  ad7768_ch_mode mode);
354 /* Get the channel mode. */
355 int32_t ad7768_get_ch_mode(ad7768_dev *dev,
356  ad7768_ch ch,
357  ad7768_ch_mode *mode);
358 /* Initialize the device. */
359 int32_t ad7768_setup(ad7768_dev **device,
361 /* Free the resources allocated by ad7768_setup(). */
362 int ad7768_remove(ad7768_dev *dev);
363 /* Begin initializing the device. */
366 /* Finish initializing the device. */
367 int32_t ad7768_setup_finish(ad7768_dev *dev,
369 /* Set available sampling frequency. */
371 /* Set power mode and sampling frequency. */
373  enum ad7768_power_modes_raw mode);
374 #endif // AD7768_H_
ad7768_setup
int32_t ad7768_setup(ad7768_dev **device, ad7768_init_param init_param)
Definition: ad7768.c:619
ad7768_set_available_sampl_freq
void ad7768_set_available_sampl_freq(ad7768_dev *dev)
Definition: ad7768.c:846
ad7768_get_ch_state
int32_t ad7768_get_ch_state(ad7768_dev *dev, ad7768_ch ch, ad7768_ch_state *state)
Definition: ad7768.c:492
ad7768_dev
Definition: ad7768.h:226
ad7768_set_power_mode
int32_t ad7768_set_power_mode(ad7768_dev *dev, ad7768_power_mode mode)
Definition: ad7768.c:223
ad7768_init_param::sleep_mode
ad7768_sleep_mode sleep_mode
Definition: ad7768.h:265
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
ad7768_map_power_mode_to_regval
#define ad7768_map_power_mode_to_regval(x)
Definition: ad7768.h:97
AD7768_MAX_DCLK_DIV
#define AD7768_MAX_DCLK_DIV
Definition: ad7768.h:112
AD7768_DEC_X1024_2ND
@ AD7768_DEC_X1024_2ND
Definition: ad7768.h:204
ad7768_power_mode
ad7768_power_mode
Definition: ad7768.h:127
ad7768_get_crc_sel
int32_t ad7768_get_crc_sel(ad7768_dev *dev, ad7768_crc_sel *crc_sel)
Definition: ad7768.c:439
AD7768_PWR_MODE_MCLK_DIV_MSK
#define AD7768_PWR_MODE_MCLK_DIV_MSK
Definition: ad7768.h:95
ad7768_dev::sleep_mode
ad7768_sleep_mode sleep_mode
Definition: ad7768.h:236
ad7768_mclk_div
ad7768_mclk_div
Definition: ad7768.h:140
ad7768_set_sleep_mode
int32_t ad7768_set_sleep_mode(ad7768_dev *dev, ad7768_sleep_mode mode)
Definition: ad7768.c:159
AD7768_CH3
@ AD7768_CH3
Definition: ad7768.h:174
AD7768_CH_MODE_DEC_RATE
#define AD7768_CH_MODE_DEC_RATE(x)
Definition: ad7768.h:85
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
ad7768_dev::mclk_div
ad7768_mclk_div mclk_div
Definition: ad7768.h:239
AD7768_NUM_POWER_MODES
@ AD7768_NUM_POWER_MODES
Definition: ad7768.h:137
ad7768_spi_write_mask
int32_t ad7768_spi_write_mask(ad7768_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t data)
Definition: ad7768.c:135
no_os_spi.h
Header file of SPI Interface.
ad7768_dev::pin_spi_ctrl
ad7768_pin_spi_ctrl pin_spi_ctrl
Definition: ad7768.h:235
AD7768_DEC_X256
@ AD7768_DEC_X256
Definition: ad7768.h:201
AD7768_DEC_X512
@ AD7768_DEC_X512
Definition: ad7768.h:202
ad7768_dev::gpio_reset_value
uint8_t gpio_reset_value
Definition: ad7768.h:229
AD7768_FAST_MODE
@ AD7768_FAST_MODE
Definition: ad7768.h:136
ad7768_spi_write
int32_t ad7768_spi_write(ad7768_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Definition: ad7768.c:91
ad7768_set_sleep_mode
int32_t ad7768_set_sleep_mode(ad7768_dev *dev, ad7768_sleep_mode mode)
Definition: ad7768.c:159
AD7768_DCLK_DIV_2
@ AD7768_DCLK_DIV_2
Definition: ad7768.h:149
AD7768_CH_MODE_DEC_RATE_MSK
#define AD7768_CH_MODE_DEC_RATE_MSK
Definition: ad7768.h:84
ad7768_avail_freq::n_freqs
unsigned int n_freqs
Definition: ad7768.h:222
AD7768_DCLK_DIV_1
@ AD7768_DCLK_DIV_1
Definition: ad7768.h:150
ad7768_dev::mclk
unsigned int mclk
Definition: ad7768.h:247
AD7768_LOW_POWER_MODE
@ AD7768_LOW_POWER_MODE
Definition: ad7768.h:134
ad7768_setup_finish
int32_t ad7768_setup_finish(ad7768_dev *dev, ad7768_init_param init_param)
Definition: ad7768.c:701
AD7768_FILTER_SINC
@ AD7768_FILTER_SINC
Definition: ad7768.h:194
ad7768_init_param::crc_sel
ad7768_crc_sel crc_sel
Definition: ad7768.h:270
ad7768_get_ch_mode
int32_t ad7768_get_ch_mode(ad7768_dev *dev, ad7768_ch ch, ad7768_ch_mode *mode)
Definition: ad7768.c:603
ad7768_spi_write
int32_t ad7768_spi_write(ad7768_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Definition: ad7768.c:91
ad7768_get_mclk_div
int32_t ad7768_get_mclk_div(ad7768_dev *dev, ad7768_mclk_div *clk_div)
Definition: ad7768.c:295
AD7768_FILTER_WIDEBAND
@ AD7768_FILTER_WIDEBAND
Definition: ad7768.h:193
AD7768_SAMPLE_SIZE
#define AD7768_SAMPLE_SIZE
Definition: ad7768.h:115
AD7768_STANDARD_CONV
@ AD7768_STANDARD_CONV
Definition: ad7768.h:159
NO_OS_DIV_ROUND_CLOSEST_ULL
#define NO_OS_DIV_ROUND_CLOSEST_ULL(x, y)
Definition: no_os_util.h:56
AD7768_DEC_X1024
@ AD7768_DEC_X1024
Definition: ad7768.h:203
AD7768_REG_CH_STANDBY
#define AD7768_REG_CH_STANDBY
Definition: ad7768.h:46
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:148
ad7768_crc_sel
ad7768_crc_sel
Definition: ad7768.h:163
device
Definition: ad9361_util.h:69
ad7768_dev::dec_rate
ad7768_dec_rate dec_rate[2]
Definition: ad7768.h:246
ad7768_get_sleep_mode
int32_t ad7768_get_sleep_mode(ad7768_dev *dev, ad7768_sleep_mode *mode)
Definition: ad7768.c:177
AD7768_REG_INTERFACE_CFG
#define AD7768_REG_INTERFACE_CFG
Definition: ad7768.h:53
ad7768_get_conv_op
int32_t ad7768_get_conv_op(ad7768_dev *dev, ad7768_conv_op *conv_op)
Definition: ad7768.c:404
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
ad7768_ch_state
ad7768_ch_state
Definition: ad7768.h:182
ad7768_remove
int ad7768_remove(ad7768_dev *dev)
Definition: ad7768.c:916
AD7768_INTERFACE_CFG_DCLK_DIV_MODE
#define AD7768_INTERFACE_CFG_DCLK_DIV_MODE(x)
Definition: ad7768.h:111
ad7768_get_sleep_mode
int32_t ad7768_get_sleep_mode(ad7768_dev *dev, ad7768_sleep_mode *mode)
Definition: ad7768.c:177
ad7768_dev::gpio_mode0
struct no_os_gpio_desc * gpio_mode0
Definition: ad7768.h:230
ad7768_setup_finish
int32_t ad7768_setup_finish(ad7768_dev *dev, ad7768_init_param init_param)
Definition: ad7768.c:701
ad7768_dev::power_mode
ad7768_power_mode power_mode
Definition: ad7768.h:237
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
ad7768_init_param::power_mode
ad7768_power_mode power_mode
Definition: ad7768.h:266
ad7768_set_conv_op
int32_t ad7768_set_conv_op(ad7768_dev *dev, ad7768_conv_op conv_op)
Definition: ad7768.c:367
AD7768_DEC_X64
@ AD7768_DEC_X64
Definition: ad7768.h:199
AD7768_ACTIVE
@ AD7768_ACTIVE
Definition: ad7768.h:123
ad7768_set_mode_pins
int32_t ad7768_set_mode_pins(ad7768_dev *dev, uint8_t state)
Definition: ad7768.c:191
AD7768_CH_NO
@ AD7768_CH_NO
Definition: ad7768.h:179
ad7768_set_crc_sel
int32_t ad7768_set_crc_sel(ad7768_dev *dev, ad7768_crc_sel crc_sel)
Definition: ad7768.c:421
AD7768_DATA_CTRL_SINGLE_SHOT_EN
#define AD7768_DATA_CTRL_SINGLE_SHOT_EN
Definition: ad7768.h:101
AD7768_DCLK_DIV_8
@ AD7768_DCLK_DIV_8
Definition: ad7768.h:147
no_os_error.h
Error codes definition.
AD7768_MCLK_DIV_8
@ AD7768_MCLK_DIV_8
Definition: ad7768.h:142
ad7768_set_mode_config
int32_t ad7768_set_mode_config(ad7768_dev *dev, ad7768_ch_mode mode, ad7768_filt_type filt_type, ad7768_dec_rate dec_rate)
Definition: ad7768.c:519
ad7768_set_crc_sel
int32_t ad7768_set_crc_sel(ad7768_dev *dev, ad7768_crc_sel crc_sel)
Definition: ad7768.c:421
ad7768_get_dclk_div
int32_t ad7768_get_dclk_div(ad7768_dev *dev, ad7768_dclk_div *clk_div)
Definition: ad7768.c:350
AD7768_CH_MODE
#define AD7768_CH_MODE(x)
Definition: ad7768.h:88
ad7768_ch
ad7768_ch
Definition: ad7768.h:170
ad7768_freq_config::freq
unsigned int freq
Definition: ad7768.h:217
ad7768_dev::dclk_div
ad7768_dclk_div dclk_div
Definition: ad7768.h:240
ad7768_setup_begin
int32_t ad7768_setup_begin(ad7768_dev **device, ad7768_init_param init_param)
Definition: ad7768.c:651
AD7768_INTERFACE_CFG_DCLK_DIV_MSK
#define AD7768_INTERFACE_CFG_DCLK_DIV_MSK
Definition: ad7768.h:110
AD7768_MCLK_DIV_4
@ AD7768_MCLK_DIV_4
Definition: ad7768.h:143
ad7768_get_power_mode
int32_t ad7768_get_power_mode(ad7768_dev *dev, ad7768_power_mode *mode)
Definition: ad7768.c:260
ad7768_init_param::conv_op
ad7768_conv_op conv_op
Definition: ad7768.h:269
ad7768_set_dclk_div
int32_t ad7768_set_dclk_div(ad7768_dev *dev, ad7768_dclk_div clk_div)
Definition: ad7768.c:313
AD7768_ENABLED
@ AD7768_ENABLED
Definition: ad7768.h:183
ad7768_set_power_mode_and_sampling_freq
int ad7768_set_power_mode_and_sampling_freq(ad7768_dev *dev, enum ad7768_power_modes_raw mode)
Definition: ad7768.c:877
ad7768_dec_rate
ad7768_dec_rate
Definition: ad7768.h:197
ad7768_spi_read_mask
int32_t ad7768_spi_read_mask(ad7768_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t *data)
Definition: ad7768.c:113
AD7768_CRC_4
@ AD7768_CRC_4
Definition: ad7768.h:165
AD7768_REG_DATA_CTRL
#define AD7768_REG_DATA_CTRL
Definition: ad7768.h:52
ad7768_pin_spi_ctrl
ad7768_pin_spi_ctrl
Definition: ad7768.h:153
ad7768_dev::filt_type
ad7768_filt_type filt_type[2]
Definition: ad7768.h:245
AD7768_DEC_X1024_3RD
@ AD7768_DEC_X1024_3RD
Definition: ad7768.h:205
ad7768_dev::power_mode_raw
enum ad7768_power_modes_raw power_mode_raw
Definition: ad7768.h:238
AD7768_ECO
@ AD7768_ECO
Definition: ad7768.h:128
AD7768_PWR_MODE_POWER_MODE_MSK
#define AD7768_PWR_MODE_POWER_MODE_MSK
Definition: ad7768.h:91
ad7768_dev::gpio_mode2
struct no_os_gpio_desc * gpio_mode2
Definition: ad7768.h:232
ad7768_set_conv_op
int32_t ad7768_set_conv_op(ad7768_dev *dev, ad7768_conv_op conv_op)
Definition: ad7768.c:367
ad7768_dev::gpio_reset
struct no_os_gpio_desc * gpio_reset
Definition: ad7768.h:228
ad7768_ch_mode
ad7768_ch_mode
Definition: ad7768.h:187
ad7768_setup
int32_t ad7768_setup(ad7768_dev **device, ad7768_init_param init_param)
Definition: ad7768.c:619
AD7768_PWR_MODE_POWER_MODE
#define AD7768_PWR_MODE_POWER_MODE(x)
Definition: ad7768.h:93
ad7768_set_available_sampl_freq
void ad7768_set_available_sampl_freq(ad7768_dev *dev)
Definition: ad7768.c:846
ad7768_init_param::mclk_div
ad7768_mclk_div mclk_div
Definition: ad7768.h:267
ad7768.h
Header file of AD7768 Driver.
ad7768_dev::gpio_mode1
struct no_os_gpio_desc * gpio_mode1
Definition: ad7768.h:231
ad7768_filt_type
ad7768_filt_type
Definition: ad7768.h:192
AD7768_MEDIAN
@ AD7768_MEDIAN
Definition: ad7768.h:129
AD7768_CH4
@ AD7768_CH4
Definition: ad7768.h:175
AD7768_DEC_X128
@ AD7768_DEC_X128
Definition: ad7768.h:200
ad7768_dev::sampling_freq
unsigned int sampling_freq
Definition: ad7768.h:249
ad7768_init_param::mclk
unsigned int mclk
Definition: ad7768.h:271
AD7768_STANDBY
@ AD7768_STANDBY
Definition: ad7768.h:184
AD7768_INTERFACE_CFG_DCLK_DIV
#define AD7768_INTERFACE_CFG_DCLK_DIV(x)
Definition: ad7768.h:109
AD7768_PWR_MODE_MCLK_DIV
#define AD7768_PWR_MODE_MCLK_DIV(x)
Definition: ad7768.h:96
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
AD7768_CH1
@ AD7768_CH1
Definition: ad7768.h:172
AD7768_DATA_CONTROL_SPI_SYNC_MSK
#define AD7768_DATA_CONTROL_SPI_SYNC_MSK
Definition: ad7768.h:103
spi_init
struct no_os_spi_init_param spi_init
Definition: common_data.c:120
AD7768_NUM_CHANNELS
#define AD7768_NUM_CHANNELS
Definition: ad7768.h:117
AD7768_MODE_A
@ AD7768_MODE_A
Definition: ad7768.h:188
ad7768_spi_read_mask
int32_t ad7768_spi_read_mask(ad7768_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t *data)
Definition: ad7768.c:113
ad7768_get_conv_op
int32_t ad7768_get_conv_op(ad7768_dev *dev, ad7768_conv_op *conv_op)
Definition: ad7768.c:404
ad7768_dev::crc_sel
ad7768_crc_sel crc_sel
Definition: ad7768.h:242
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
AD7768_CH7
@ AD7768_CH7
Definition: ad7768.h:178
AD7768_CH6
@ AD7768_CH6
Definition: ad7768.h:177
AD7768_CRC_16_2ND
@ AD7768_CRC_16_2ND
Definition: ad7768.h:167
AD7768_REG_CH_MODE_B
#define AD7768_REG_CH_MODE_B
Definition: ad7768.h:48
ad7768_conv_op
ad7768_conv_op
Definition: ad7768.h:158
ad7768_spi_write_mask
int32_t ad7768_spi_write_mask(ad7768_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t data)
Definition: ad7768.c:135
AD7768_FAST
@ AD7768_FAST
Definition: ad7768.h:130
standard_pin_ctrl_mode_sel
const uint8_t standard_pin_ctrl_mode_sel[3][4]
Definition: ad7768.c:44
ad7768_dev::conv_op
ad7768_conv_op conv_op
Definition: ad7768.h:241
AD7768_MAX_FREQ_PER_MODE
#define AD7768_MAX_FREQ_PER_MODE
Definition: ad7768.h:116
ad7768_set_ch_mode
int32_t ad7768_set_ch_mode(ad7768_dev *dev, ad7768_ch ch, ad7768_ch_mode mode)
Definition: ad7768.c:575
ad7768_dev::pin_spi_input_value
uint8_t pin_spi_input_value
Definition: ad7768.h:234
AD7768_CH2
@ AD7768_CH2
Definition: ad7768.h:173
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
AD7768_MCLK_DIV_32
@ AD7768_MCLK_DIV_32
Definition: ad7768.h:141
ad7768_dev::ch_state
ad7768_ch_state ch_state[8]
Definition: ad7768.h:243
ad7768_dev::ch_mode
ad7768_ch_mode ch_mode[8]
Definition: ad7768.h:244
ad7768_get_mode_config
int32_t ad7768_get_mode_config(ad7768_dev *dev, ad7768_ch_mode mode, ad7768_filt_type *filt_type, ad7768_dec_rate *dec_rate)
Definition: ad7768.c:547
no_os_find_last_set_bit
uint32_t no_os_find_last_set_bit(uint32_t word)
AD7768_ONE_SHOT_CONV
@ AD7768_ONE_SHOT_CONV
Definition: ad7768.h:160
ad7768_power_modes_raw
ad7768_power_modes_raw
Definition: ad7768.h:133
ad7768_get_mclk_div
int32_t ad7768_get_mclk_div(ad7768_dev *dev, ad7768_mclk_div *clk_div)
Definition: ad7768.c:295
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
ad7768_avail_freq::freq_cfg
struct ad7768_freq_config freq_cfg[AD7768_MAX_FREQ_PER_MODE]
Definition: ad7768.h:223
ad7768_set_power_mode
int32_t ad7768_set_power_mode(ad7768_dev *dev, ad7768_power_mode mode)
Definition: ad7768.c:223
ad7768_freq_config::dec_rate
unsigned int dec_rate
Definition: ad7768.h:218
AD7768_DATA_CONTROL_SPI_SYNC
#define AD7768_DATA_CONTROL_SPI_SYNC
Definition: ad7768.h:104
ad7768_set_mode_config
int32_t ad7768_set_mode_config(ad7768_dev *dev, ad7768_ch_mode mode, ad7768_filt_type filt_type, ad7768_dec_rate dec_rate)
Definition: ad7768.c:519
AD7768_SPI_CTRL
@ AD7768_SPI_CTRL
Definition: ad7768.h:155
AD7768_DEC_X32
@ AD7768_DEC_X32
Definition: ad7768.h:198
AD7768_REG_PWR_MODE
#define AD7768_REG_PWR_MODE
Definition: ad7768.h:50
ad7768_get_power_mode
int32_t ad7768_get_power_mode(ad7768_dev *dev, ad7768_power_mode *mode)
Definition: ad7768.c:260
ad7768_dev::gpio_mode3
struct no_os_gpio_desc * gpio_mode3
Definition: ad7768.h:233
ad7768_dev::avail_freq
struct ad7768_avail_freq avail_freq[AD7768_NUM_POWER_MODES]
Definition: ad7768.h:250
ad7768_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad7768.h:227
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ad7768_set_ch_mode
int32_t ad7768_set_ch_mode(ad7768_dev *dev, ad7768_ch ch, ad7768_ch_mode mode)
Definition: ad7768.c:575
AD7768_PIN_CTRL
@ AD7768_PIN_CTRL
Definition: ad7768.h:154
AD7768_INTERFACE_CFG_CRC_SEL
#define AD7768_INTERFACE_CFG_CRC_SEL(x)
Definition: ad7768.h:108
ad7768_dclk_div
ad7768_dclk_div
Definition: ad7768.h:146
ad7768_get_mode_config
int32_t ad7768_get_mode_config(ad7768_dev *dev, ad7768_ch_mode mode, ad7768_filt_type *filt_type, ad7768_dec_rate *dec_rate)
Definition: ad7768.c:547
ad7768_remove
int ad7768_remove(ad7768_dev *dev)
Definition: ad7768.c:916
ad7768_set_mclk_div
int32_t ad7768_set_mclk_div(ad7768_dev *dev, ad7768_mclk_div clk_div)
Definition: ad7768.c:277
AD7768_MODE_B
@ AD7768_MODE_B
Definition: ad7768.h:189
AD7768_CH0
@ AD7768_CH0
Definition: ad7768.h:171
ad7768_init_param::pin_spi_input_value
uint8_t pin_spi_input_value
Definition: ad7768.h:264
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
AD7768_NO_CRC
@ AD7768_NO_CRC
Definition: ad7768.h:164
ad7768_spi_read
int32_t ad7768_spi_read(ad7768_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Definition: ad7768.c:65
no_os_gpio.h
Header file of GPIO Interface.
ad7768_set_ch_state
int32_t ad7768_set_ch_state(ad7768_dev *dev, ad7768_ch ch, ad7768_ch_state state)
Definition: ad7768.c:464
AD7768_REG_CH_MODE_A
#define AD7768_REG_CH_MODE_A
Definition: ad7768.h:47
ad7768_init_param::datalines
unsigned int datalines
Definition: ad7768.h:272
ad7768_set_mclk_div
int32_t ad7768_set_mclk_div(ad7768_dev *dev, ad7768_mclk_div clk_div)
Definition: ad7768.c:277
ad7768_dev::datalines
unsigned int datalines
Definition: ad7768.h:248
ad7768_get_ch_mode
int32_t ad7768_get_ch_mode(ad7768_dev *dev, ad7768_ch ch, ad7768_ch_mode *mode)
Definition: ad7768.c:603
AD7768_CH_STANDBY
#define AD7768_CH_STANDBY(x)
Definition: ad7768.h:80
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
AD7768_DCLK_DIV_4
@ AD7768_DCLK_DIV_4
Definition: ad7768.h:148
ad7768_spi_read
int32_t ad7768_spi_read(ad7768_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Definition: ad7768.c:65
AD7768_MEDIAN_MODE
@ AD7768_MEDIAN_MODE
Definition: ad7768.h:135
ad7768_freq_config
Definition: ad7768.h:216
no_os_util.h
Header file of utility functions.
no_os_hweight32
unsigned int no_os_hweight32(uint32_t word)
AD7768_SLEEP
@ AD7768_SLEEP
Definition: ad7768.h:124
AD7768_PWR_MODE_SLEEP_MODE
#define AD7768_PWR_MODE_SLEEP_MODE
Definition: ad7768.h:92
AD7768_REG_CH_MODE_SEL
#define AD7768_REG_CH_MODE_SEL
Definition: ad7768.h:49
ad7768_get_dclk_div
int32_t ad7768_get_dclk_div(ad7768_dev *dev, ad7768_dclk_div *clk_div)
Definition: ad7768.c:350
ad7768_setup_begin
int32_t ad7768_setup_begin(ad7768_dev **device, ad7768_init_param init_param)
Definition: ad7768.c:651
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
ad7768_init_param
Definition: ad7768.h:253
one_shot_pin_ctrl_mode_sel
const uint8_t one_shot_pin_ctrl_mode_sel[3][4]
Definition: ad7768.c:51
ad7768_init_param::dclk_div
ad7768_dclk_div dclk_div
Definition: ad7768.h:268
ad7768_get_crc_sel
int32_t ad7768_get_crc_sel(ad7768_dev *dev, ad7768_crc_sel *crc_sel)
Definition: ad7768.c:439
ad7768_set_power_mode_and_sampling_freq
int ad7768_set_power_mode_and_sampling_freq(ad7768_dev *dev, enum ad7768_power_modes_raw mode)
Definition: ad7768.c:877
ad7768_set_dclk_div
int32_t ad7768_set_dclk_div(ad7768_dev *dev, ad7768_dclk_div clk_div)
Definition: ad7768.c:313
ad7768_sleep_mode
ad7768_sleep_mode
Definition: ad7768.h:122
AD7768_CRC_16
@ AD7768_CRC_16
Definition: ad7768.h:166
ad7768_avail_freq
Definition: ad7768.h:221
ad7768_init_param::gpio_reset_value
uint8_t gpio_reset_value
Definition: ad7768.h:258
ad7768_get_ch_state
int32_t ad7768_get_ch_state(ad7768_dev *dev, ad7768_ch ch, ad7768_ch_state *state)
Definition: ad7768.c:492
ad7768_set_ch_state
int32_t ad7768_set_ch_state(ad7768_dev *dev, ad7768_ch ch, ad7768_ch_state state)
Definition: ad7768.c:464
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
AD7768_CH5
@ AD7768_CH5
Definition: ad7768.h:176
AD7768_CH_MODE_FILTER_TYPE
#define AD7768_CH_MODE_FILTER_TYPE
Definition: ad7768.h:83
AD7768_DATA_CONTROL_SPI_SYNC_CLEAR
#define AD7768_DATA_CONTROL_SPI_SYNC_CLEAR
Definition: ad7768.h:105