Example program for EVAL-AD5770R
Dependencies: adi_console_menu platform_drivers
Diff: app/ad5770r_console_app.c
- Revision:
- 5:f3d7cf95cd8f
- Parent:
- 3:8a6aa77aba73
diff -r ddef2e8cb4f7 -r f3d7cf95cd8f app/ad5770r_console_app.c --- a/app/ad5770r_console_app.c Wed Feb 24 12:18:35 2021 +0000 +++ b/app/ad5770r_console_app.c Tue Aug 03 17:34:58 2021 +0100 @@ -7,7 +7,7 @@ @details: ----------------------------------------------------------------------------- * -Copyright (c) 2020 Analog Devices, Inc. All Rights Reserved. +Copyright (c) 2020-2021 Analog Devices, Inc. All Rights Reserved. This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated @@ -24,7 +24,10 @@ #include "app_config.h" -#include "platform_drivers.h" +#include "delay.h" +#include "error.h" +#include "gpio.h" +#include "spi.h" #include "platform_support.h" #include "ad5770r.h" @@ -162,7 +165,7 @@ printf("\n\r *** Error doing device remove ***\n\r"); } - pAd5770r_dev = NULL; + pAd5770r_dev = NULL; adi_press_any_key_to_continue(); return(MENU_CONTINUE); @@ -330,9 +333,9 @@ printf(EOL "Enter Input register value (hex) for channel %d: " EOL, channel_id); value = adi_get_hex_integer(4); - - /* Channels are 14-bits, mask off top 2 bits*/ - value &= 0x3FFF; + + /* Channels are 14-bits, mask off top 2 bits*/ + value &= 0x3FFF; if ((status = ad5770r_set_dac_input(pAd5770r_dev, value, @@ -357,9 +360,9 @@ printf(EOL "Enter DAC register value (hex) for channel %d: " EOL, channel_id); value = adi_get_hex_integer(4); - /* Channels are 14-bits, mask off top 2 bits*/ - value &= 0x3FFF; - + /* Channels are 14-bits, mask off top 2 bits*/ + value &= 0x3FFF; + if ((status = ad5770r_set_dac_value(pAd5770r_dev, value, (enum ad5770r_channels) channel_id)) != SUCCESS) { @@ -710,21 +713,21 @@ * DAC Operations Menu */ static console_menu_item dac_operations_menu_items[] = { - {"\tSet Input Channel 0", 'Q', do_input_value, 0}, - {"\tSet Input Channel 1", 'W', do_input_value, 1}, - {"\tSet Input Channel 2", 'E', do_input_value, 2}, - {"\tSet Input Channel 3", 'R', do_input_value, 3}, - {"\tSet Input Channel 4", 'T', do_input_value, 4}, - {"\tSet Input Channel 5", 'Y', do_input_value, 5}, - {""}, - {"\tToggle Channel 0 SW LDAC Shadow", '0', do_sw_ldac, AD5770R_HW_LDAC_MASK_CH(1, 0)}, + {"\tSet Input Channel 0", 'Q', do_input_value, 0}, + {"\tSet Input Channel 1", 'W', do_input_value, 1}, + {"\tSet Input Channel 2", 'E', do_input_value, 2}, + {"\tSet Input Channel 3", 'R', do_input_value, 3}, + {"\tSet Input Channel 4", 'T', do_input_value, 4}, + {"\tSet Input Channel 5", 'Y', do_input_value, 5}, + {""}, + {"\tToggle Channel 0 SW LDAC Shadow", '0', do_sw_ldac, AD5770R_HW_LDAC_MASK_CH(1, 0)}, {"\tToggle Channel 1 SW LDAC Shadow", '1', do_sw_ldac, AD5770R_HW_LDAC_MASK_CH(1, 1)}, {"\tToggle Channel 2 SW LDAC Shadow", '2', do_sw_ldac, AD5770R_HW_LDAC_MASK_CH(1, 2)}, {"\tToggle Channel 3 SW LDAC Shadow", '3', do_sw_ldac, AD5770R_HW_LDAC_MASK_CH(1, 3)}, {"\tToggle Channel 4 SW LDAC Shadow", '4', do_sw_ldac, AD5770R_HW_LDAC_MASK_CH(1, 4)}, {"\tToggle Channel 5 SW LDAC Shadow", '5', do_sw_ldac, AD5770R_HW_LDAC_MASK_CH(1, 5)}, {"\tWrite SW LDAC Shadow ", 'U', do_sw_ldac_write}, - {""}, + {""}, {"\tToggle HW LDAC digital input", 'J', do_hw_ldac_toggle}, {""}, {"\tSet DAC Channel 0", 'A', do_dac_value, 0},