This is an forked repository to push changes related to no-OS repository adoption
Dependencies: adi_console_menu platform_drivers
app/ad5592r_user_config.c@4:242c10fbdbb8, 2021-08-02 (annotated)
- Committer:
- pmallick
- Date:
- Mon Aug 02 11:50:39 2021 +0530
- Revision:
- 4:242c10fbdbb8
- Parent:
- 1:e84d8d51cd51
No-OS Adoption Changes:
* Updated the .lib files for adoption of no-OS repository as-is.
* Replaced 'platform_drivers.h' with required header files.
* Updated the copyright year.
Mbed OS update changes:
1) Added the mbed_app.json file with custom parameters.
2) Updated the mbed-os version to 6.8.0
Updated the readme 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 | ----------------------------------------------------------------------------- |
pmallick | 4:242c10fbdbb8 | 8 | Copyright (c) 2020-2021 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" |
pmallick | 4:242c10fbdbb8 | 27 | #include "i2c.h" |
pmallick | 4:242c10fbdbb8 | 28 | #include "spi.h" |
EndaKilgarriff | 1:e84d8d51cd51 | 29 | #include "spi_extra.h" |
EndaKilgarriff | 1:e84d8d51cd51 | 30 | #include "i2c_extra.h" |
EndaKilgarriff | 1:e84d8d51cd51 | 31 | |
EndaKilgarriff | 1:e84d8d51cd51 | 32 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 33 | /***************************** Type Definitions **********************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 34 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 35 | mbed_spi_init_param spi_init_extra_params = { |
EndaKilgarriff | 1:e84d8d51cd51 | 36 | .spi_clk_pin = SPI_SCK, |
EndaKilgarriff | 1:e84d8d51cd51 | 37 | .spi_miso_pin = SPI_MISO, |
EndaKilgarriff | 1:e84d8d51cd51 | 38 | .spi_mosi_pin = SPI_MOSI |
EndaKilgarriff | 1:e84d8d51cd51 | 39 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 40 | |
EndaKilgarriff | 1:e84d8d51cd51 | 41 | mbed_i2c_init_param i2c_init_extra_params = { |
EndaKilgarriff | 1:e84d8d51cd51 | 42 | .i2c_sda_pin = I2C_SDA, |
EndaKilgarriff | 1:e84d8d51cd51 | 43 | .i2c_scl_pin = I2C_SCL |
EndaKilgarriff | 1:e84d8d51cd51 | 44 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 45 | |
EndaKilgarriff | 1:e84d8d51cd51 | 46 | spi_desc spi_user_descr = { |
EndaKilgarriff | 1:e84d8d51cd51 | 47 | .max_speed_hz = 1000000, |
EndaKilgarriff | 1:e84d8d51cd51 | 48 | .chip_select = SPI_SS_A, |
EndaKilgarriff | 1:e84d8d51cd51 | 49 | .mode = SPI_MODE_2, |
EndaKilgarriff | 1:e84d8d51cd51 | 50 | .extra = &spi_init_extra_params |
EndaKilgarriff | 1:e84d8d51cd51 | 51 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 52 | |
EndaKilgarriff | 1:e84d8d51cd51 | 53 | i2c_desc i2c_user_descr = { |
EndaKilgarriff | 1:e84d8d51cd51 | 54 | .max_speed_hz = 100000, |
EndaKilgarriff | 1:e84d8d51cd51 | 55 | .slave_address = AD5593R_I2C, |
EndaKilgarriff | 1:e84d8d51cd51 | 56 | .extra = &i2c_init_extra_params |
EndaKilgarriff | 1:e84d8d51cd51 | 57 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 58 | |
EndaKilgarriff | 1:e84d8d51cd51 | 59 | spi_init_param spi_user_params = { |
EndaKilgarriff | 1:e84d8d51cd51 | 60 | .max_speed_hz = 1000000, |
EndaKilgarriff | 1:e84d8d51cd51 | 61 | .chip_select = SPI_SS_A, |
EndaKilgarriff | 1:e84d8d51cd51 | 62 | .mode = SPI_MODE_2, |
EndaKilgarriff | 1:e84d8d51cd51 | 63 | .extra = &spi_init_extra_params, |
EndaKilgarriff | 1:e84d8d51cd51 | 64 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 65 | |
EndaKilgarriff | 1:e84d8d51cd51 | 66 | i2c_init_param i2c_user_params = { |
EndaKilgarriff | 1:e84d8d51cd51 | 67 | .max_speed_hz = 100000, |
EndaKilgarriff | 1:e84d8d51cd51 | 68 | .slave_address = AD5593R_I2C, |
EndaKilgarriff | 1:e84d8d51cd51 | 69 | .extra = &i2c_init_extra_params |
EndaKilgarriff | 1:e84d8d51cd51 | 70 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 71 | |
EndaKilgarriff | 1:e84d8d51cd51 | 72 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 73 | /***************************** Constants **********************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 74 | /******************************************************************************/ |
EndaKilgarriff | 1:e84d8d51cd51 | 75 | const struct ad5592r_init_param ad5592r_user_param = { |
EndaKilgarriff | 1:e84d8d51cd51 | 76 | .int_ref = false |
EndaKilgarriff | 1:e84d8d51cd51 | 77 | }; |
EndaKilgarriff | 1:e84d8d51cd51 | 78 | |
EndaKilgarriff | 1:e84d8d51cd51 | 79 | const struct ad5592r_dev ad5592r_dev_user = { |
EndaKilgarriff | 1:e84d8d51cd51 | 80 | .ops = NULL, |
EndaKilgarriff | 1:e84d8d51cd51 | 81 | .spi = NULL, |
EndaKilgarriff | 1:e84d8d51cd51 | 82 | .i2c = NULL, |
EndaKilgarriff | 1:e84d8d51cd51 | 83 | .spi_msg = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 84 | .num_channels = NUM_CHANNELS, |
EndaKilgarriff | 1:e84d8d51cd51 | 85 | .cached_dac = { 0, 0, 0, 0, 0, 0, 0 }, |
EndaKilgarriff | 1:e84d8d51cd51 | 86 | .cached_gp_ctrl = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 87 | .channel_modes = { |
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 | CH_MODE_UNUSED |
EndaKilgarriff | 1:e84d8d51cd51 | 96 | }, |
EndaKilgarriff | 1:e84d8d51cd51 | 97 | .channel_offstate = { |
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 | CH_OFFSTATE_PULLDOWN |
EndaKilgarriff | 1:e84d8d51cd51 | 106 | }, |
EndaKilgarriff | 1:e84d8d51cd51 | 107 | .gpio_out = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 108 | .gpio_in = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 109 | .gpio_val = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 110 | .ldac_mode = 0, |
EndaKilgarriff | 1:e84d8d51cd51 | 111 | }; |