Initial Commit
Dependencies: platform_drivers AD5592R adi_console_menu
app/ad5592r_user_config.c@3:ae77c589c81a, 2020-06-22 (annotated)
- Committer:
- EndaKilgarriff
- Date:
- Mon Jun 22 22:27:26 2020 +0000
- Revision:
- 3:ae77c589c81a
- Parent:
- 1:e84d8d51cd51
Add License file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EndaKilgarriff | 1:e84d8d51cd51 | 1 | /*! |
EndaKilgarriff | 1:e84d8d51cd51 | 2 | ***************************************************************************** |
EndaKilgarriff | 1:e84d8d51cd51 | 3 | @file: ad5592r_user_config.c |
EndaKilgarriff | 1:e84d8d51cd51 | 4 | @brief: Device parameters, structure and initial condition settings |
EndaKilgarriff | 1:e84d8d51cd51 | 5 | @details: Settings for parameters and descriptors for interface protocols. Start up configuration |
EndaKilgarriff | 1:e84d8d51cd51 | 6 | |
EndaKilgarriff | 1:e84d8d51cd51 | 7 | ----------------------------------------------------------------------------- |
EndaKilgarriff | 1:e84d8d51cd51 | 8 | Copyright (c) 2020 Analog Devices, Inc. |
EndaKilgarriff | 1:e84d8d51cd51 | 9 | All rights reserved. |
EndaKilgarriff | 1:e84d8d51cd51 | 10 | |
EndaKilgarriff | 1:e84d8d51cd51 | 11 | This software is proprietary to Analog Devices, Inc. and its licensors. |
EndaKilgarriff | 1:e84d8d51cd51 | 12 | By using this software you agree to the terms of the associated |
EndaKilgarriff | 1:e84d8d51cd51 | 13 | Analog Devices Software License Agreement. |
EndaKilgarriff | 1:e84d8d51cd51 | 14 | *****************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 15 | |
EndaKilgarriff | 1:e84d8d51cd51 | 16 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 17 | /***************************** Include Files **********************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 18 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 19 | #include <stdint.h> |
EndaKilgarriff | 1:e84d8d51cd51 | 20 | #include <stdbool.h> |
EndaKilgarriff | 1:e84d8d51cd51 | 21 | #include <stddef.h> |
EndaKilgarriff | 1:e84d8d51cd51 | 22 | |
EndaKilgarriff | 1:e84d8d51cd51 | 23 | #include "app_config.h" |
EndaKilgarriff | 1:e84d8d51cd51 | 24 | |
EndaKilgarriff | 1:e84d8d51cd51 | 25 | #include "ad5592r-base.h" |
EndaKilgarriff | 1:e84d8d51cd51 | 26 | #include "platform_support.h" |
EndaKilgarriff | 1:e84d8d51cd51 | 27 | #include "platform_drivers.h" |
EndaKilgarriff | 1:e84d8d51cd51 | 28 | #include "spi_extra.h" |
EndaKilgarriff | 1:e84d8d51cd51 | 29 | #include "i2c_extra.h" |
EndaKilgarriff | 1:e84d8d51cd51 | 30 | |
EndaKilgarriff | 1:e84d8d51cd51 | 31 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 32 | /***************************** Type Definitions **********************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 33 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 34 | mbed_spi_init_param spi_init_extra_params = { |
EndaKilgarriff | 1:e84d8d51cd51 | 35 | .spi_clk_pin = SPI_SCK, |
EndaKilgarriff | 1:e84d8d51cd51 | 36 | .spi_miso_pin = SPI_MISO, |
EndaKilgarriff | 1:e84d8d51cd51 | 37 | .spi_mosi_pin = SPI_MOSI |
EndaKilgarriff | 1:e84d8d51cd51 | 38 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 39 | |
EndaKilgarriff | 1:e84d8d51cd51 | 40 | mbed_i2c_init_param i2c_init_extra_params = { |
EndaKilgarriff | 1:e84d8d51cd51 | 41 | .i2c_sda_pin = I2C_SDA, |
EndaKilgarriff | 1:e84d8d51cd51 | 42 | .i2c_scl_pin = I2C_SCL |
EndaKilgarriff | 1:e84d8d51cd51 | 43 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 44 | |
EndaKilgarriff | 1:e84d8d51cd51 | 45 | spi_desc spi_user_descr = { |
EndaKilgarriff | 1:e84d8d51cd51 | 46 | .max_speed_hz = 1000000, |
EndaKilgarriff | 1:e84d8d51cd51 | 47 | .chip_select = SPI_SS_A, |
EndaKilgarriff | 1:e84d8d51cd51 | 48 | .mode = SPI_MODE_2, |
EndaKilgarriff | 1:e84d8d51cd51 | 49 | .extra = &spi_init_extra_params |
EndaKilgarriff | 1:e84d8d51cd51 | 50 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 51 | |
EndaKilgarriff | 1:e84d8d51cd51 | 52 | i2c_desc i2c_user_descr = { |
EndaKilgarriff | 1:e84d8d51cd51 | 53 | .max_speed_hz = 100000, |
EndaKilgarriff | 1:e84d8d51cd51 | 54 | .slave_address = AD5593R_I2C, |
EndaKilgarriff | 1:e84d8d51cd51 | 55 | .extra = &i2c_init_extra_params |
EndaKilgarriff | 1:e84d8d51cd51 | 56 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 57 | |
EndaKilgarriff | 1:e84d8d51cd51 | 58 | spi_init_param spi_user_params = { |
EndaKilgarriff | 1:e84d8d51cd51 | 59 | .max_speed_hz = 1000000, |
EndaKilgarriff | 1:e84d8d51cd51 | 60 | .chip_select = SPI_SS_A, |
EndaKilgarriff | 1:e84d8d51cd51 | 61 | .mode = SPI_MODE_2, |
EndaKilgarriff | 1:e84d8d51cd51 | 62 | .extra = &spi_init_extra_params, |
EndaKilgarriff | 1:e84d8d51cd51 | 63 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 64 | |
EndaKilgarriff | 1:e84d8d51cd51 | 65 | i2c_init_param i2c_user_params = { |
EndaKilgarriff | 1:e84d8d51cd51 | 66 | .max_speed_hz = 100000, |
EndaKilgarriff | 1:e84d8d51cd51 | 67 | .slave_address = AD5593R_I2C, |
EndaKilgarriff | 1:e84d8d51cd51 | 68 | .extra = &i2c_init_extra_params |
EndaKilgarriff | 1:e84d8d51cd51 | 69 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 70 | |
EndaKilgarriff | 1:e84d8d51cd51 | 71 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 72 | /***************************** Constants **********************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 73 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 74 | const struct ad5592r_init_param ad5592r_user_param = { |
EndaKilgarriff | 1:e84d8d51cd51 | 75 | .int_ref = false |
EndaKilgarriff | 1:e84d8d51cd51 | 76 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 77 | |
EndaKilgarriff | 1:e84d8d51cd51 | 78 | const struct ad5592r_dev ad5592r_dev_user = { |
EndaKilgarriff | 1:e84d8d51cd51 | 79 | .ops = NULL, |
EndaKilgarriff | 1:e84d8d51cd51 | 80 | .spi = NULL, |
EndaKilgarriff | 1:e84d8d51cd51 | 81 | .i2c = NULL, |
EndaKilgarriff | 1:e84d8d51cd51 | 82 | .spi_msg = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 83 | .num_channels = NUM_CHANNELS, |
EndaKilgarriff | 1:e84d8d51cd51 | 84 | .cached_dac = { 0, 0, 0, 0, 0, 0, 0 }, |
EndaKilgarriff | 1:e84d8d51cd51 | 85 | .cached_gp_ctrl = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 86 | .channel_modes = { |
EndaKilgarriff | 1:e84d8d51cd51 | 87 | CH_MODE_UNUSED, |
EndaKilgarriff | 1:e84d8d51cd51 | 88 | CH_MODE_UNUSED, |
EndaKilgarriff | 1:e84d8d51cd51 | 89 | CH_MODE_UNUSED, |
EndaKilgarriff | 1:e84d8d51cd51 | 90 | CH_MODE_UNUSED, |
EndaKilgarriff | 1:e84d8d51cd51 | 91 | CH_MODE_UNUSED, |
EndaKilgarriff | 1:e84d8d51cd51 | 92 | CH_MODE_UNUSED, |
EndaKilgarriff | 1:e84d8d51cd51 | 93 | CH_MODE_UNUSED, |
EndaKilgarriff | 1:e84d8d51cd51 | 94 | CH_MODE_UNUSED |
EndaKilgarriff | 1:e84d8d51cd51 | 95 | }, |
EndaKilgarriff | 1:e84d8d51cd51 | 96 | .channel_offstate = { |
EndaKilgarriff | 1:e84d8d51cd51 | 97 | CH_OFFSTATE_PULLDOWN, |
EndaKilgarriff | 1:e84d8d51cd51 | 98 | CH_OFFSTATE_PULLDOWN, |
EndaKilgarriff | 1:e84d8d51cd51 | 99 | CH_OFFSTATE_PULLDOWN, |
EndaKilgarriff | 1:e84d8d51cd51 | 100 | CH_OFFSTATE_PULLDOWN, |
EndaKilgarriff | 1:e84d8d51cd51 | 101 | CH_OFFSTATE_PULLDOWN, |
EndaKilgarriff | 1:e84d8d51cd51 | 102 | CH_OFFSTATE_PULLDOWN, |
EndaKilgarriff | 1:e84d8d51cd51 | 103 | CH_OFFSTATE_PULLDOWN, |
EndaKilgarriff | 1:e84d8d51cd51 | 104 | CH_OFFSTATE_PULLDOWN |
EndaKilgarriff | 1:e84d8d51cd51 | 105 | }, |
EndaKilgarriff | 1:e84d8d51cd51 | 106 | .gpio_out = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 107 | .gpio_in = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 108 | .gpio_val = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 109 | .ldac_mode = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 110 | }; |