Analog Devices / Mbed OS EVAL-AD5592R

Dependencies:   adi_console_menu platform_drivers

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ad5592r_user_config.c Source File

ad5592r_user_config.c

Go to the documentation of this file.
00001 /*!
00002  *****************************************************************************
00003   @file:  ad5592r_user_config.c
00004   @brief: Device parameters, structure and initial condition settings
00005   @details: Settings for parameters and descriptors for interface protocols. Start up configuration
00006 
00007  -----------------------------------------------------------------------------
00008  Copyright (c) 2020-2021 Analog Devices, Inc.
00009  All rights reserved.
00010 
00011  This software is proprietary to Analog Devices, Inc. and its licensors.
00012  By using this software you agree to the terms of the associated
00013  Analog Devices Software License Agreement.
00014 *****************************************************************************/
00015 
00016 /******************************************************************************/
00017 /***************************** Include Files **********************************/
00018 /******************************************************************************/
00019 #include <stdint.h>
00020 #include <stdbool.h>
00021 #include <stddef.h>
00022 
00023 #include "app_config.h"
00024 
00025 #include "ad5592r-base.h"
00026 #include "platform_support.h"
00027 #include "i2c.h"
00028 #include "spi.h"
00029 #include "spi_extra.h"
00030 #include "i2c_extra.h"
00031 
00032 /******************************************************************************/
00033 /***************************** Type Definitions **********************************/
00034 /******************************************************************************/
00035 mbed_spi_init_param spi_init_extra_params = {
00036     .spi_clk_pin = SPI_SCK,
00037     .spi_miso_pin = SPI_MISO,
00038     .spi_mosi_pin = SPI_MOSI
00039 };
00040 
00041 mbed_i2c_init_param i2c_init_extra_params = {
00042     .i2c_sda_pin = I2C_SDA,
00043     .i2c_scl_pin = I2C_SCL
00044 };
00045 
00046 spi_desc spi_user_descr = {
00047     .max_speed_hz = 1000000,
00048     .chip_select = SPI_SS_A,
00049     .mode = SPI_MODE_2,
00050     .extra = &spi_init_extra_params
00051 };
00052 
00053 i2c_desc i2c_user_descr = {
00054     .max_speed_hz = 100000,
00055     .slave_address = AD5593R_I2C,
00056     .extra = &i2c_init_extra_params
00057 };
00058 
00059 spi_init_param spi_user_params = {
00060     .max_speed_hz = 1000000,
00061     .chip_select = SPI_SS_A,
00062     .mode = SPI_MODE_2,
00063     .extra = &spi_init_extra_params,
00064 };
00065 
00066 i2c_init_param i2c_user_params = {
00067     .max_speed_hz = 100000,
00068     .slave_address = AD5593R_I2C,
00069     .extra = &i2c_init_extra_params
00070 };
00071 
00072 /******************************************************************************/
00073 /***************************** Constants  **********************************/
00074 /******************************************************************************/
00075 const struct ad5592r_init_param ad5592r_user_param = {
00076     .int_ref = false
00077 };
00078 
00079 const struct ad5592r_dev ad5592r_dev_user = {
00080     .ops = NULL,
00081     .spi = NULL,
00082     .i2c = NULL,
00083     .spi_msg = 0,
00084     .num_channels = NUM_CHANNELS,
00085     .cached_dac = { 0, 0, 0, 0, 0, 0, 0 },
00086     .cached_gp_ctrl = 0,
00087     .channel_modes = {
00088         CH_MODE_UNUSED,
00089         CH_MODE_UNUSED,
00090         CH_MODE_UNUSED,
00091         CH_MODE_UNUSED,
00092         CH_MODE_UNUSED,
00093         CH_MODE_UNUSED,
00094         CH_MODE_UNUSED,
00095         CH_MODE_UNUSED
00096     },
00097     .channel_offstate = {
00098         CH_OFFSTATE_PULLDOWN,
00099         CH_OFFSTATE_PULLDOWN,
00100         CH_OFFSTATE_PULLDOWN,
00101         CH_OFFSTATE_PULLDOWN,
00102         CH_OFFSTATE_PULLDOWN,
00103         CH_OFFSTATE_PULLDOWN,
00104         CH_OFFSTATE_PULLDOWN,
00105         CH_OFFSTATE_PULLDOWN
00106     },
00107     .gpio_out = 0,
00108     .gpio_in = 0,
00109     .gpio_val = 0,
00110     .ldac_mode = 0,
00111 };