Pratyush Mallick / Mbed OS EVAL-AD4696

Dependencies:   platform_drivers

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ad4696_user_config.c Source File

ad4696_user_config.c

Go to the documentation of this file.
00001 /*************************************************************************//**
00002  *   @file   ad4696_user_config.c
00003  *   @brief  User configuration file for AD4696 device
00004 ******************************************************************************
00005 * Copyright (c) 2021 Analog Devices, Inc.
00006 *
00007 * All rights reserved.
00008 *
00009 * This software is proprietary to Analog Devices, Inc. and its licensors.
00010 * By using this software you agree to the terms of the associated
00011 * Analog Devices Software License Agreement.
00012 *****************************************************************************/
00013 
00014 /******************************************************************************/
00015 /***************************** Include Files **********************************/
00016 /******************************************************************************/
00017 
00018 #include <stdint.h>
00019 #include "app_config.h"
00020 #include "ad4696_user_config.h"
00021 #include "ad4696_support.h"
00022 #include "gpio.h"
00023 #include "spi_extra.h"
00024 #include "gpio_extra.h"
00025 
00026 /******************************************************************************/
00027 /********************** Macros and Constants Definition ***********************/
00028 /******************************************************************************/
00029 
00030 #define     USER_CONFIG_RANGE   (DEFAULT_CHN_RANGE * 1000)
00031 
00032 /******************************************************************************/
00033 /********************** Variables and User Defined Data Types *****************/
00034 /******************************************************************************/
00035 
00036 struct gpio_init_param gpio_init_reset = {
00037     .number = RESET_PIN,
00038     .extra = NULL
00039 };
00040 
00041 struct gpio_init_param gpio_init_convst = {
00042     .number = CONVST_PIN,
00043     .extra = NULL
00044 };
00045 
00046 struct gpio_init_param gpio_init_busy = {
00047     .number = BUSY_PIN,
00048     .extra = &bsy_gpio_extra_init_params
00049 };
00050 
00051 struct spi_init_param spi_init_params = {
00052     .max_speed_hz = 22500000,       // Max SPI Speed
00053     .chip_select = SPI_CSB,         // Chip Select
00054     .mode = SPI_MODE_3,             // CPOL = 1, CPHA = 1
00055     .extra = &spi_extra_init_params // SPI extra configurations
00056 };
00057 
00058 /* Initialize the AD4696 device structure */
00059 struct ad469x_init_param ad4696_init_str = {
00060     // Define SPI init parameters structure
00061     .spi_init = &spi_init_params,
00062 
00063     // Define GPIOs init parameter structure
00064     .gpio_resetn = &gpio_init_reset,
00065     .gpio_convst = &gpio_init_convst,
00066     .gpio_busy = &gpio_init_busy,
00067     .dev_id = ACTIVE_DEVICE
00068 };