AD7768-1 MBED IIO Application Example

Dependencies:   platform_drivers

Committer:
epena
Date:
Fri Sep 24 18:39:34 2021 +0800
Revision:
1:c0429edee15b
Adding Released source code of ad7768-1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
epena 1:c0429edee15b 1 /*****************************************************************************
epena 1:c0429edee15b 2 * @file ad77681_user_config.h
epena 1:c0429edee15b 3 *
epena 1:c0429edee15b 4 * @brief User configuration settings for AD77681 on start-up
epena 1:c0429edee15b 5 *
epena 1:c0429edee15b 6 * @details
epena 1:c0429edee15b 7 ******************************************************************************
epena 1:c0429edee15b 8 Copyright (c) 2021 Analog Devices, Inc. All Rights Reserved.
epena 1:c0429edee15b 9
epena 1:c0429edee15b 10 This software is proprietary to Analog Devices, Inc. and its licensors.
epena 1:c0429edee15b 11 By using this software you agree to the terms of the associated
epena 1:c0429edee15b 12 Analog Devices Software License Agreement.
epena 1:c0429edee15b 13 ******************************************************************************/
epena 1:c0429edee15b 14
epena 1:c0429edee15b 15 /******************************************************************************/
epena 1:c0429edee15b 16 /***************************** Include Files **********************************/
epena 1:c0429edee15b 17 /******************************************************************************/
epena 1:c0429edee15b 18 #include <stdint.h>
epena 1:c0429edee15b 19
epena 1:c0429edee15b 20 #include "app_config.h"
epena 1:c0429edee15b 21 #include "app_config_mbed.h"
epena 1:c0429edee15b 22 #include "ad77681_user_config.h"
epena 1:c0429edee15b 23
epena 1:c0429edee15b 24 /******************************************************************************/
epena 1:c0429edee15b 25 /********************** Macros and Constants Definition ***********************/
epena 1:c0429edee15b 26 /******************************************************************************/
epena 1:c0429edee15b 27
epena 1:c0429edee15b 28 // Initialize the ad77681 device structure
epena 1:c0429edee15b 29 struct ad77681_init_param sad77681_init = {
epena 1:c0429edee15b 30 // Define SPI init parameters structure
epena 1:c0429edee15b 31 .spi_eng_dev_init =
epena 1:c0429edee15b 32 {
epena 1:c0429edee15b 33 .max_speed_hz = 22500000, // Max SPI Speed
epena 1:c0429edee15b 34 .chip_select = SPI_SS, // Chip Select
epena 1:c0429edee15b 35 .mode = SPI_MODE_3, // CPOL = 1, CPHA = 1
epena 1:c0429edee15b 36 .extra = &spi_init_extra_params // SPI extra configurations
epena 1:c0429edee15b 37 },
epena 1:c0429edee15b 38 .power_mode = AD77681_FAST,
epena 1:c0429edee15b 39 .mclk_div = AD77681_MCLK_DIV_8,
epena 1:c0429edee15b 40 .conv_mode = AD77681_CONV_CONTINUOUS,
epena 1:c0429edee15b 41 .diag_mux_sel = AD77681_TEMP_SENSOR,
epena 1:c0429edee15b 42 .conv_diag_sel = false,
epena 1:c0429edee15b 43 .conv_len = AD77681_CONV_24BIT,
epena 1:c0429edee15b 44 .crc_sel = AD77681_NO_CRC,
epena 1:c0429edee15b 45 .status_bit = 0,
epena 1:c0429edee15b 46 .VCM_out = AD77681_VCM_0_9V,
epena 1:c0429edee15b 47 .AINn = AD77681_AINn_DISABLED,
epena 1:c0429edee15b 48 .AINp = AD77681_AINp_DISABLED,
epena 1:c0429edee15b 49 .REFn = AD77681_BUFn_ENABLED,
epena 1:c0429edee15b 50 .REFp = AD77681_BUFp_ENABLED,
epena 1:c0429edee15b 51 .filter = AD77681_SINC5,
epena 1:c0429edee15b 52 .decimate = AD77681_SINC5_FIR_DECx32,
epena 1:c0429edee15b 53 .sinc3_osr = 0,
epena 1:c0429edee15b 54 .vref = AD77681_VOLTAGE_REF,
epena 1:c0429edee15b 55 .mclk = AD77681_MCLK,
epena 1:c0429edee15b 56 .sample_rate = AD77681_DEFAULT_SAMPLING_FREQ,
epena 1:c0429edee15b 57 .data_frame_byte = AD77681_DECIMATION_RATE
epena 1:c0429edee15b 58 };