Example program for EVAL-AD5770R

Dependencies:   adi_console_menu platform_drivers

Committer:
Kjansen
Date:
Tue Aug 03 17:34:58 2021 +0100
Revision:
5:f3d7cf95cd8f
Parent:
1:63c505e13da4
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.
* Indentation fixes.

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?

UserRevisionLine numberNew contents of line
mbradley 1:63c505e13da4 1 /*!
mbradley 1:63c505e13da4 2 *****************************************************************************
mbradley 1:63c505e13da4 3 @file: ad5770_user_config.c
mbradley 1:63c505e13da4 4 @brief: AD5770R user configuration
mbradley 1:63c505e13da4 5 @details:
mbradley 1:63c505e13da4 6 -----------------------------------------------------------------------------
mbradley 1:63c505e13da4 7 *
Kjansen 5:f3d7cf95cd8f 8 Copyright (c) 2020-2021 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 "app_config.h"
mbradley 1:63c505e13da4 21
Kjansen 5:f3d7cf95cd8f 22 #include "spi.h"
mbradley 1:63c505e13da4 23 #include "spi_extra.h"
mbradley 1:63c505e13da4 24
mbradley 1:63c505e13da4 25 #include "ad5770r.h"
mbradley 1:63c505e13da4 26
mbradley 1:63c505e13da4 27
mbradley 1:63c505e13da4 28 // #defines
mbradley 1:63c505e13da4 29
mbradley 1:63c505e13da4 30 // type defintions
mbradley 1:63c505e13da4 31
mbradley 1:63c505e13da4 32 // constants
mbradley 1:63c505e13da4 33 struct mbed_spi_init_param spi_init_extra_params = {
mbradley 1:63c505e13da4 34 .spi_clk_pin = SPI_SCK,
mbradley 1:63c505e13da4 35 .spi_miso_pin = SPI_MISO,
mbradley 1:63c505e13da4 36 .spi_mosi_pin = SPI_MOSI
mbradley 1:63c505e13da4 37 };
mbradley 1:63c505e13da4 38
mbradley 1:63c505e13da4 39 struct ad5770r_init_param ad5770r_user_param = {
mbradley 1:63c505e13da4 40 /* SPI */
mbradley 1:63c505e13da4 41 .spi_init = {
mbradley 1:63c505e13da4 42 .max_speed_hz = 2500000,
mbradley 1:63c505e13da4 43 .chip_select = SPI_SS,
mbradley 1:63c505e13da4 44 .mode = SPI_MODE_0,
mbradley 1:63c505e13da4 45 .extra = &spi_init_extra_params
mbradley 1:63c505e13da4 46 },
mbradley 1:63c505e13da4 47
mbradley 1:63c505e13da4 48 /* Device SPI Settings */
mbradley 1:63c505e13da4 49 .dev_spi_settings = {
mbradley 1:63c505e13da4 50 .addr_ascension = false,
mbradley 1:63c505e13da4 51 .single_instruction = false,
mbradley 1:63c505e13da4 52 .stream_mode_length = 0
mbradley 1:63c505e13da4 53 },
mbradley 1:63c505e13da4 54
mbradley 1:63c505e13da4 55 /* Device Settings */
mbradley 1:63c505e13da4 56 .channel_config = {
mbradley 1:63c505e13da4 57 .en0 = true,
mbradley 1:63c505e13da4 58 .en1 = true,
mbradley 1:63c505e13da4 59 .en2 = true,
mbradley 1:63c505e13da4 60 .en3 = true,
mbradley 1:63c505e13da4 61 .en4 = true,
mbradley 1:63c505e13da4 62 .en5 = true,
mbradley 1:63c505e13da4 63 .sink0 = false
mbradley 1:63c505e13da4 64 },
mbradley 1:63c505e13da4 65
mbradley 1:63c505e13da4 66 .output_mode = {
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 .output_scale = 0x00,
mbradley 1:63c505e13da4 77 .output_range_mode = 0x00
mbradley 1:63c505e13da4 78 },
mbradley 1:63c505e13da4 79 {
mbradley 1:63c505e13da4 80 .output_scale = 0x00,
mbradley 1:63c505e13da4 81 .output_range_mode = 0x00
mbradley 1:63c505e13da4 82 },
mbradley 1:63c505e13da4 83 {
mbradley 1:63c505e13da4 84 .output_scale = 0x00,
mbradley 1:63c505e13da4 85 .output_range_mode = 0x00
mbradley 1:63c505e13da4 86 },
mbradley 1:63c505e13da4 87 {
mbradley 1:63c505e13da4 88 .output_scale = 0x00,
mbradley 1:63c505e13da4 89 .output_range_mode = 0x00
mbradley 1:63c505e13da4 90 },
mbradley 1:63c505e13da4 91 },
mbradley 1:63c505e13da4 92
mbradley 1:63c505e13da4 93 .external_reference = true,
mbradley 1:63c505e13da4 94 .reference_selector = AD5770R_EXT_REF_1_25_V,
mbradley 1:63c505e13da4 95 .alarm_config = {
mbradley 1:63c505e13da4 96 .open_drain_en = false,
mbradley 1:63c505e13da4 97 .thermal_shutdown_en = false,
mbradley 1:63c505e13da4 98 .background_crc_en = false,
mbradley 1:63c505e13da4 99 .temp_warning_msk = false,
mbradley 1:63c505e13da4 100 .over_temp_msk = false,
mbradley 1:63c505e13da4 101 .neg_ch0_msk = false,
mbradley 1:63c505e13da4 102 .iref_fault_msk = false,
mbradley 1:63c505e13da4 103 .background_crc_msk = false
mbradley 1:63c505e13da4 104 },
mbradley 1:63c505e13da4 105 .output_filter = {
mbradley 1:63c505e13da4 106 AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM,
mbradley 1:63c505e13da4 107 AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM,
mbradley 1:63c505e13da4 108 AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM,
mbradley 1:63c505e13da4 109 AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM,
mbradley 1:63c505e13da4 110 AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM,
mbradley 1:63c505e13da4 111 AD5770R_OUTPUT_FILTER_RESISTOR_60_OHM
mbradley 1:63c505e13da4 112 },
mbradley 1:63c505e13da4 113 .mon_setup = {
mbradley 1:63c505e13da4 114 .monitor_function = AD5770R_CURRENT_MONITORING,
mbradley 1:63c505e13da4 115 .mux_buffer = false,
mbradley 1:63c505e13da4 116 .ib_ext_en = true,
mbradley 1:63c505e13da4 117 .monitor_channel = AD5770R_CH3
mbradley 1:63c505e13da4 118 },
mbradley 1:63c505e13da4 119 .mask_hw_ldac = {
mbradley 1:63c505e13da4 120 .en0 = true,
mbradley 1:63c505e13da4 121 .en1 = true,
mbradley 1:63c505e13da4 122 .en2 = true,
mbradley 1:63c505e13da4 123 .en3 = true,
mbradley 1:63c505e13da4 124 .en4 = true,
mbradley 1:63c505e13da4 125 .en5 = true,
mbradley 1:63c505e13da4 126 },
mbradley 1:63c505e13da4 127 .dac_value = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
mbradley 1:63c505e13da4 128 .page_mask = {
mbradley 1:63c505e13da4 129 .dac_data_page_mask = 0x0000,
mbradley 1:63c505e13da4 130 .input_page_mask = 0x0000
mbradley 1:63c505e13da4 131 },
mbradley 1:63c505e13da4 132 .mask_channel_sel = {
mbradley 1:63c505e13da4 133 .en0 = true,
mbradley 1:63c505e13da4 134 .en1 = true,
mbradley 1:63c505e13da4 135 .en2 = true,
mbradley 1:63c505e13da4 136 .en3 = true,
mbradley 1:63c505e13da4 137 .en4 = true,
mbradley 1:63c505e13da4 138 .en5 = true,
mbradley 1:63c505e13da4 139 },
mbradley 1:63c505e13da4 140 .sw_ldac = {
mbradley 1:63c505e13da4 141 .en0 = true,
mbradley 1:63c505e13da4 142 .en1 = true,
mbradley 1:63c505e13da4 143 .en2 = true,
mbradley 1:63c505e13da4 144 .en3 = true,
mbradley 1:63c505e13da4 145 .en4 = true,
mbradley 1:63c505e13da4 146 .en5 = true,
mbradley 1:63c505e13da4 147 },
mbradley 1:63c505e13da4 148 .input_value = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6}
mbradley 1:63c505e13da4 149 };
mbradley 1:63c505e13da4 150
mbradley 1:63c505e13da4 151 // static variables