Example program for EVAL-AD5770R
Dependencies: adi_console_menu platform_drivers
app/ad5770r_reset_config.c@4:ddef2e8cb4f7, 2021-02-24 (annotated)
- Committer:
- mahphalke
- Date:
- Wed Feb 24 12:18:35 2021 +0000
- Revision:
- 4:ddef2e8cb4f7
- Parent:
- 1:63c505e13da4
- Child:
- 5:f3d7cf95cd8f
Changed Mbed-OS revision to 5.15.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbradley | 1:63c505e13da4 | 1 | /*! |
mbradley | 1:63c505e13da4 | 2 | ***************************************************************************** |
mbradley | 1:63c505e13da4 | 3 | @file: ad5770r_reset_config.c |
mbradley | 1:63c505e13da4 | 4 | @brief: AD5770R initialization configuration |
mbradley | 1:63c505e13da4 | 5 | @details: |
mbradley | 1:63c505e13da4 | 6 | ----------------------------------------------------------------------------- |
mbradley | 1:63c505e13da4 | 7 | * |
mbradley | 1:63c505e13da4 | 8 | Copyright (c) 2020 Analog Devices, Inc. All Rights Reserved. |
mbradley | 1:63c505e13da4 | 9 | |
mbradley | 1:63c505e13da4 | 10 | This software is proprietary to Analog Devices, Inc. and its licensors. |
mbradley | 1:63c505e13da4 | 11 | By using this software you agree to the terms of the associated |
mbradley | 1:63c505e13da4 | 12 | Analog Devices Software License Agreement. |
mbradley | 1:63c505e13da4 | 13 | ******************************************************************************/ |
mbradley | 1:63c505e13da4 | 14 | |
mbradley | 1:63c505e13da4 | 15 | // #includes |
mbradley | 1:63c505e13da4 | 16 | #include <stdint.h> |
mbradley | 1:63c505e13da4 | 17 | #include <stdbool.h> |
mbradley | 1:63c505e13da4 | 18 | #include <stddef.h> |
mbradley | 1:63c505e13da4 | 19 | |
mbradley | 1:63c505e13da4 | 20 | #include "platform_drivers.h" |
mbradley | 1:63c505e13da4 | 21 | #include "ad5770r.h" |
mbradley | 1:63c505e13da4 | 22 | |
mbradley | 1:63c505e13da4 | 23 | // #defines |
mbradley | 1:63c505e13da4 | 24 | |
mbradley | 1:63c505e13da4 | 25 | // type defintions |
mbradley | 1:63c505e13da4 | 26 | |
mbradley | 1:63c505e13da4 | 27 | // constants |
mbradley | 1:63c505e13da4 | 28 | const struct ad5770r_dev ad5770r_dev_reset = { |
mbradley | 1:63c505e13da4 | 29 | /* SPI */ |
mbradley | 1:63c505e13da4 | 30 | .spi_desc = NULL, |
mbradley | 1:63c505e13da4 | 31 | |
mbradley | 1:63c505e13da4 | 32 | /* Device SPI Settings */ |
mbradley | 1:63c505e13da4 | 33 | .dev_spi_settings = { |
mbradley | 1:63c505e13da4 | 34 | .addr_ascension = false, |
mbradley | 1:63c505e13da4 | 35 | .single_instruction = false, |
mbradley | 1:63c505e13da4 | 36 | .stream_mode_length = 0 |
mbradley | 1:63c505e13da4 | 37 | }, |
mbradley | 1:63c505e13da4 | 38 | |
mbradley | 1:63c505e13da4 | 39 | /* Device Settings */ |
mbradley | 1:63c505e13da4 | 40 | .channel_config = { |
mbradley | 1:63c505e13da4 | 41 | .en0 = false, |
mbradley | 1:63c505e13da4 | 42 | .en1 = false, |
mbradley | 1:63c505e13da4 | 43 | .en2 = false, |
mbradley | 1:63c505e13da4 | 44 | .en3 = false, |
mbradley | 1:63c505e13da4 | 45 | .en4 = false, |
mbradley | 1:63c505e13da4 | 46 | .en5 = false, |
mbradley | 1:63c505e13da4 | 47 | .sink0 = true |
mbradley | 1:63c505e13da4 | 48 | }, |
mbradley | 1:63c505e13da4 | 49 | |
mbradley | 1:63c505e13da4 | 50 | .output_mode = { |
mbradley | 1:63c505e13da4 | 51 | { |
mbradley | 1:63c505e13da4 | 52 | .output_scale = 0x00, |
mbradley | 1:63c505e13da4 | 53 | .output_range_mode = 0x00 |
mbradley | 1:63c505e13da4 | 54 | }, |
mbradley | 1:63c505e13da4 | 55 | { |
mbradley | 1:63c505e13da4 | 56 | .output_scale = 0x00, |
mbradley | 1:63c505e13da4 | 57 | .output_range_mode = 0x02 |
mbradley | 1:63c505e13da4 | 58 | }, |
mbradley | 1:63c505e13da4 | 59 | { |
mbradley | 1:63c505e13da4 | 60 | .output_scale = 0x00, |
mbradley | 1:63c505e13da4 | 61 | .output_range_mode = 0x00 |
mbradley | 1:63c505e13da4 | 62 | }, |
mbradley | 1:63c505e13da4 | 63 | { |
mbradley | 1:63c505e13da4 | 64 | .output_scale = 0x00, |
mbradley | 1:63c505e13da4 | 65 | .output_range_mode = 0x00 |
mbradley | 1:63c505e13da4 | 66 | }, |
mbradley | 1:63c505e13da4 | 67 | { |
mbradley | 1:63c505e13da4 | 68 | .output_scale = 0x00, |
mbradley | 1:63c505e13da4 | 69 | .output_range_mode = 0x00 |
mbradley | 1:63c505e13da4 | 70 | }, |
mbradley | 1:63c505e13da4 | 71 | { |
mbradley | 1:63c505e13da4 | 72 | .output_scale = 0x00, |
mbradley | 1:63c505e13da4 | 73 | .output_range_mode = 0x00 |
mbradley | 1:63c505e13da4 | 74 | }, |
mbradley | 1:63c505e13da4 | 75 | }, |
mbradley | 1:63c505e13da4 | 76 | |
mbradley | 1:63c505e13da4 | 77 | .external_reference = false, |
mbradley | 1:63c505e13da4 | 78 | .reference_selector = AD5770R_EXT_REF_2_5_V, |
mbradley | 1:63c505e13da4 | 79 | .alarm_config = { |
mbradley | 1:63c505e13da4 | 80 | .open_drain_en = false, |
mbradley | 1:63c505e13da4 | 81 | .thermal_shutdown_en = false, |
mbradley | 1:63c505e13da4 | 82 | .background_crc_en = true, |
mbradley | 1:63c505e13da4 | 83 | .temp_warning_msk = false, |
mbradley | 1:63c505e13da4 | 84 | .over_temp_msk = false, |
mbradley | 1:63c505e13da4 | 85 | .neg_ch0_msk = false, |
mbradley | 1:63c505e13da4 | 86 | .iref_fault_msk = false, |
mbradley | 1:63c505e13da4 | 87 | .background_crc_msk = true |
mbradley | 1:63c505e13da4 | 88 | }, |
mbradley | 1:63c505e13da4 | 89 | .output_filter = { |
mbradley | 1:63c505e13da4 | 90 | AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM, |
mbradley | 1:63c505e13da4 | 91 | AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM, |
mbradley | 1:63c505e13da4 | 92 | AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM, |
mbradley | 1:63c505e13da4 | 93 | AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM, |
mbradley | 1:63c505e13da4 | 94 | AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM, |
mbradley | 1:63c505e13da4 | 95 | AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM |
mbradley | 1:63c505e13da4 | 96 | }, |
mbradley | 1:63c505e13da4 | 97 | .mon_setup = { |
mbradley | 1:63c505e13da4 | 98 | .monitor_function = AD5770R_DISABLE, |
mbradley | 1:63c505e13da4 | 99 | .mux_buffer = false, |
mbradley | 1:63c505e13da4 | 100 | .ib_ext_en = false, |
mbradley | 1:63c505e13da4 | 101 | .monitor_channel = AD5770R_CH0 |
mbradley | 1:63c505e13da4 | 102 | }, |
mbradley | 1:63c505e13da4 | 103 | .mask_hw_ldac = { |
mbradley | 1:63c505e13da4 | 104 | .en0 = false, |
mbradley | 1:63c505e13da4 | 105 | .en1 = false, |
mbradley | 1:63c505e13da4 | 106 | .en2 = false, |
mbradley | 1:63c505e13da4 | 107 | .en3 = false, |
mbradley | 1:63c505e13da4 | 108 | .en4 = false, |
mbradley | 1:63c505e13da4 | 109 | .en5 = false, |
mbradley | 1:63c505e13da4 | 110 | }, |
mbradley | 1:63c505e13da4 | 111 | .dac_value = {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, |
mbradley | 1:63c505e13da4 | 112 | .page_mask = { |
mbradley | 1:63c505e13da4 | 113 | .dac_data_page_mask = 0x0000, |
mbradley | 1:63c505e13da4 | 114 | .input_page_mask = 0x0000 |
mbradley | 1:63c505e13da4 | 115 | }, |
mbradley | 1:63c505e13da4 | 116 | .mask_channel_sel = { |
mbradley | 1:63c505e13da4 | 117 | .en0 = false, |
mbradley | 1:63c505e13da4 | 118 | .en1 = false, |
mbradley | 1:63c505e13da4 | 119 | .en2 = false, |
mbradley | 1:63c505e13da4 | 120 | .en3 = false, |
mbradley | 1:63c505e13da4 | 121 | .en4 = false, |
mbradley | 1:63c505e13da4 | 122 | .en5 = false, |
mbradley | 1:63c505e13da4 | 123 | }, |
mbradley | 1:63c505e13da4 | 124 | .sw_ldac = { |
mbradley | 1:63c505e13da4 | 125 | .en0 = false, |
mbradley | 1:63c505e13da4 | 126 | .en1 = false, |
mbradley | 1:63c505e13da4 | 127 | .en2 = false, |
mbradley | 1:63c505e13da4 | 128 | .en3 = false, |
mbradley | 1:63c505e13da4 | 129 | .en4 = false, |
mbradley | 1:63c505e13da4 | 130 | .en5 = false, |
mbradley | 1:63c505e13da4 | 131 | }, |
mbradley | 1:63c505e13da4 | 132 | .input_value = {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, |
mbradley | 1:63c505e13da4 | 133 | }; |
mbradley | 1:63c505e13da4 | 134 | |
mbradley | 1:63c505e13da4 | 135 | // static variables |