Example program for EVAL-AD4130

Dependencies:   tempsensors sdp_k1_sdram

Committer:
Mahesh Phalke
Date:
Wed Jul 20 18:12:00 2022 +0530
Revision:
2:7b2b268ea49c
Initial firmware commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Mahesh Phalke 2:7b2b268ea49c 1 /***************************************************************************//**
Mahesh Phalke 2:7b2b268ea49c 2 * @file ad4130_support.h
Mahesh Phalke 2:7b2b268ea49c 3 * @brief Header for AD4130 No-OS driver supports
Mahesh Phalke 2:7b2b268ea49c 4 ********************************************************************************
Mahesh Phalke 2:7b2b268ea49c 5 * Copyright (c) 2020-2022 Analog Devices, Inc.
Mahesh Phalke 2:7b2b268ea49c 6 * All rights reserved.
Mahesh Phalke 2:7b2b268ea49c 7 *
Mahesh Phalke 2:7b2b268ea49c 8 * This software is proprietary to Analog Devices, Inc. and its licensors.
Mahesh Phalke 2:7b2b268ea49c 9 * By using this software you agree to the terms of the associated
Mahesh Phalke 2:7b2b268ea49c 10 * Analog Devices Software License Agreement.
Mahesh Phalke 2:7b2b268ea49c 11 *******************************************************************************/
Mahesh Phalke 2:7b2b268ea49c 12
Mahesh Phalke 2:7b2b268ea49c 13 #ifndef AD4130_SUPPORT_H_
Mahesh Phalke 2:7b2b268ea49c 14 #define AD4130_SUPPORT_H_
Mahesh Phalke 2:7b2b268ea49c 15
Mahesh Phalke 2:7b2b268ea49c 16 /******************************************************************************/
Mahesh Phalke 2:7b2b268ea49c 17 /***************************** Include Files **********************************/
Mahesh Phalke 2:7b2b268ea49c 18 /******************************************************************************/
Mahesh Phalke 2:7b2b268ea49c 19
Mahesh Phalke 2:7b2b268ea49c 20 #include <stdint.h>
Mahesh Phalke 2:7b2b268ea49c 21 #include "ad413x.h"
Mahesh Phalke 2:7b2b268ea49c 22
Mahesh Phalke 2:7b2b268ea49c 23 /******************************************************************************/
Mahesh Phalke 2:7b2b268ea49c 24 /********************** Macros and Constants Definition ***********************/
Mahesh Phalke 2:7b2b268ea49c 25 /******************************************************************************/
Mahesh Phalke 2:7b2b268ea49c 26
Mahesh Phalke 2:7b2b268ea49c 27 #define AD413X_ADDR(x) ((x) & 0xFF)
Mahesh Phalke 2:7b2b268ea49c 28
Mahesh Phalke 2:7b2b268ea49c 29 #define AD4130_INT_SRC_SEL_MSK NO_OS_GENMASK(9, 8)
Mahesh Phalke 2:7b2b268ea49c 30 #define AD4130_FILTER_FS_MSK NO_OS_GENMASK(10, 0)
Mahesh Phalke 2:7b2b268ea49c 31 #define AD4130_FIFO_MODE_MSK NO_OS_GENMASK(17, 16)
Mahesh Phalke 2:7b2b268ea49c 32 #define AD413X_WATERMARK_MSK NO_OS_GENMASK(7, 0)
Mahesh Phalke 2:7b2b268ea49c 33
Mahesh Phalke 2:7b2b268ea49c 34 #define AD413X_COMM_REG_RD NO_OS_BIT(6)
Mahesh Phalke 2:7b2b268ea49c 35
Mahesh Phalke 2:7b2b268ea49c 36 /******************************************************************************/
Mahesh Phalke 2:7b2b268ea49c 37 /********************** Variables and User Defined Data Types *****************/
Mahesh Phalke 2:7b2b268ea49c 38 /******************************************************************************/
Mahesh Phalke 2:7b2b268ea49c 39
Mahesh Phalke 2:7b2b268ea49c 40 /* FIFO modes */
Mahesh Phalke 2:7b2b268ea49c 41 typedef enum {
Mahesh Phalke 2:7b2b268ea49c 42 FIFO_DISABLED,
Mahesh Phalke 2:7b2b268ea49c 43 FIFO_OLDEST_SAVE_MODE,
Mahesh Phalke 2:7b2b268ea49c 44 FIFO_STREAM_MODE
Mahesh Phalke 2:7b2b268ea49c 45 } fifo_mode_e;
Mahesh Phalke 2:7b2b268ea49c 46
Mahesh Phalke 2:7b2b268ea49c 47 /* ADC conversion interrupt source */
Mahesh Phalke 2:7b2b268ea49c 48 typedef enum {
Mahesh Phalke 2:7b2b268ea49c 49 INT_PIN,
Mahesh Phalke 2:7b2b268ea49c 50 CLK_PIN,
Mahesh Phalke 2:7b2b268ea49c 51 GPIO1_PIN
Mahesh Phalke 2:7b2b268ea49c 52 } adc_conv_int_source_e;
Mahesh Phalke 2:7b2b268ea49c 53
Mahesh Phalke 2:7b2b268ea49c 54 /******************************************************************************/
Mahesh Phalke 2:7b2b268ea49c 55 /************************ Public Declarations *********************************/
Mahesh Phalke 2:7b2b268ea49c 56 /******************************************************************************/
Mahesh Phalke 2:7b2b268ea49c 57
Mahesh Phalke 2:7b2b268ea49c 58 float ad4130_get_reference_voltage(struct ad413x_dev *dev, uint8_t chn);
Mahesh Phalke 2:7b2b268ea49c 59 int32_t perform_sign_conversion(struct ad413x_dev *dev, uint32_t adc_raw_data,
Mahesh Phalke 2:7b2b268ea49c 60 uint8_t chn);
Mahesh Phalke 2:7b2b268ea49c 61 float convert_adc_sample_into_voltage(void *dev, uint32_t adc_raw,
Mahesh Phalke 2:7b2b268ea49c 62 uint8_t chn);
Mahesh Phalke 2:7b2b268ea49c 63 float convert_adc_raw_into_rtd_resistance(void *dev, uint32_t adc_raw,
Mahesh Phalke 2:7b2b268ea49c 64 float rtd_ref, uint8_t chn);
Mahesh Phalke 2:7b2b268ea49c 65 int32_t ad4130_read_fifo(struct ad413x_dev *dev, uint32_t *data,
Mahesh Phalke 2:7b2b268ea49c 66 uint32_t adc_samples);
Mahesh Phalke 2:7b2b268ea49c 67 int32_t ad413x_mon_conv_and_read_data(struct ad413x_dev *dev,
Mahesh Phalke 2:7b2b268ea49c 68 uint32_t *raw_data);
Mahesh Phalke 2:7b2b268ea49c 69 int32_t ad413x_set_int_source(struct ad413x_dev *dev,
Mahesh Phalke 2:7b2b268ea49c 70 adc_conv_int_source_e conv_int_source);
Mahesh Phalke 2:7b2b268ea49c 71 int32_t ad413x_set_filter_fs(struct ad413x_dev *dev, uint32_t fs,
Mahesh Phalke 2:7b2b268ea49c 72 uint8_t preset);
Mahesh Phalke 2:7b2b268ea49c 73
Mahesh Phalke 2:7b2b268ea49c 74 #endif /* AD4130_SUPPORT_H_ */