Example program for EVAL-AD5770R

Dependencies:   adi_console_menu platform_drivers

Embed: (wiki syntax)

« Back to documentation index

ad5770r_console_app.c File Reference

ad5770r_console_app.c File Reference

: Implementation for the menu functions that handle the AD5770R More...

Go to the source code of this file.

Functions

int32_t ad5770r_app_initialize (void)
 Initialize the AD7124 device and the SPI port as required.
int32_t ad5770r_software_reset (struct ad5770r_dev *dev)
 Performs a software reset.
static int32_t do_toggle_ref_resistor (uint32_t id)
 toggles the int/ext ref resistor option
static int32_t do_set_reference (uint32_t ref_option)
 sets the int/ext refer configuration options
static int32_t do_set_alarm (uint32_t alarm_id)
 Sets the Alarm Menu option bits.
static void ch_switches_toggle (struct ad5770r_channel_switches *ch_switches, uint32_t channel_id)
 Sets the Channel Configuration option bits.
static int32_t do_channel_config (uint32_t channel_id)
 Sets the Channel Configuration option bits.
static int32_t do_input_value (uint32_t channel_id)
 prompts user for value to write to input register on channel
static int32_t do_dac_value (uint32_t channel_id)
 prompts user for value to write to input register on channel
static int32_t do_sw_ldac (uint32_t channel_id)
 updating shadow SW LDAC, by toggling the channel bit
static int32_t do_sw_ldac_write (uint32_t id)
 Writing SW LDAC to device.
static int32_t do_hw_ldac_toggle (uint32_t id)
 Toggles HW LDAC.
static void display_gen_config (void)
 displays general device configuration state
static void print_channel_switches (struct ad5770r_channel_switches *ch_switches, char *prefix, bool include_sink)
 displays general device configuration state
static void display_dac_channel_configuration_header (void)
 displays general device configuration state
static void display_dac_operations_header (void)
 displays the SW LDAC shadown and other channel output values
static void print_monitor_setup (const struct ad5770r_monitor_setup *mon_setup)
 prints the provided monitor config to the terminal
static void display_monitor_setup_header (void)
 configure the Mux Monitor setup
static int32_t do_monitor_setup (uint32_t id)
 configure the Mux Monitor setup
static void display_main_menu_header (void)
 displays several pieces of status information above main menu
static void display_main_menu_footer (void)
 displays several pieces of status information below main menu
static int32_t do_general_configuration_menu (uint32_t id)
 calls the general configuration menu
static int32_t do_monitor_setup_menu (uint32_t id)
 calls the monitor setup menu
static int32_t do_dac_channel_configuration_menu (uint32_t id)
 calls the DAC channel confguration menu
static int32_t do_dac_operations_menu (uint32_t id)
 calls the DAC channel confguration menu

Detailed Description

: Implementation for the menu functions that handle the AD5770R

: -----------------------------------------------------------------------------

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 Analog Devices Software License Agreement.

Definition in file ad5770r_console_app.c.


Function Documentation

int32_t ad5770r_app_initialize ( void   )

Initialize the AD7124 device and the SPI port as required.

This resets and then writes the default register map value to the device. A call to init the SPI port is made, but may not actually do very much, depending on the platform

Definition at line 68 of file ad5770r_console_app.c.

int32_t ad5770r_software_reset ( struct ad5770r_dev *  dev )

Performs a software reset.

Parameters:
dev- The device structure.
Returns:
SUCCESS in case of success, negative error code otherwise.

Definition at line 96 of file ad5770r_console_app.c.

static void ch_switches_toggle ( struct ad5770r_channel_switches *  ch_switches,
uint32_t  channel_id 
) [static]

Sets the Channel Configuration option bits.

Definition at line 269 of file ad5770r_console_app.c.

static void display_dac_channel_configuration_header ( void   ) [static]

displays general device configuration state

Definition at line 488 of file ad5770r_console_app.c.

static void display_dac_operations_header ( void   ) [static]

displays the SW LDAC shadown and other channel output values

Definition at line 498 of file ad5770r_console_app.c.

static void display_gen_config ( void   ) [static]

displays general device configuration state

Definition at line 443 of file ad5770r_console_app.c.

static void display_main_menu_footer ( void   ) [static]

displays several pieces of status information below main menu

Definition at line 662 of file ad5770r_console_app.c.

static void display_main_menu_header ( void   ) [static]

displays several pieces of status information above main menu

Definition at line 616 of file ad5770r_console_app.c.

static void display_monitor_setup_header ( void   ) [static]

configure the Mux Monitor setup

Definition at line 558 of file ad5770r_console_app.c.

static int32_t do_channel_config ( uint32_t  channel_id ) [static]

Sets the Channel Configuration option bits.

Definition at line 305 of file ad5770r_console_app.c.

static int32_t do_dac_channel_configuration_menu ( uint32_t  id ) [static]

calls the DAC channel confguration menu

Definition at line 699 of file ad5770r_console_app.c.

static int32_t do_dac_operations_menu ( uint32_t  id ) [static]

calls the DAC channel confguration menu

Definition at line 707 of file ad5770r_console_app.c.

static int32_t do_dac_value ( uint32_t  channel_id ) [static]

prompts user for value to write to input register on channel

Definition at line 355 of file ad5770r_console_app.c.

static int32_t do_general_configuration_menu ( uint32_t  id ) [static]

calls the general configuration menu

Definition at line 683 of file ad5770r_console_app.c.

static int32_t do_hw_ldac_toggle ( uint32_t  id ) [static]

Toggles HW LDAC.

This toggles the LDAC pin on the device, but is independent to the driver Therefore this does not update dac_values from input values.

Definition at line 412 of file ad5770r_console_app.c.

static int32_t do_input_value ( uint32_t  channel_id ) [static]

prompts user for value to write to input register on channel

Definition at line 328 of file ad5770r_console_app.c.

static int32_t do_monitor_setup ( uint32_t  id ) [static]

configure the Mux Monitor setup

Definition at line 568 of file ad5770r_console_app.c.

static int32_t do_monitor_setup_menu ( uint32_t  id ) [static]

calls the monitor setup menu

Definition at line 691 of file ad5770r_console_app.c.

static int32_t do_set_alarm ( uint32_t  alarm_id ) [static]

Sets the Alarm Menu option bits.

Definition at line 218 of file ad5770r_console_app.c.

static int32_t do_set_reference ( uint32_t  ref_option ) [static]

sets the int/ext refer configuration options

Definition at line 199 of file ad5770r_console_app.c.

static int32_t do_sw_ldac ( uint32_t  channel_id ) [static]

updating shadow SW LDAC, by toggling the channel bit

Definition at line 381 of file ad5770r_console_app.c.

static int32_t do_sw_ldac_write ( uint32_t  id ) [static]

Writing SW LDAC to device.

Definition at line 393 of file ad5770r_console_app.c.

static int32_t do_toggle_ref_resistor ( uint32_t  id ) [static]

toggles the int/ext ref resistor option

Definition at line 179 of file ad5770r_console_app.c.

static void print_channel_switches ( struct ad5770r_channel_switches *  ch_switches,
char *  prefix,
bool  include_sink 
) [static]

displays general device configuration state

Definition at line 466 of file ad5770r_console_app.c.

static void print_monitor_setup ( const struct ad5770r_monitor_setup *  mon_setup ) [static]

prints the provided monitor config to the terminal

Parameters:
ad5770R_monitor_configmonitor_config - struct for the monitor config to be displayed
Returns:
SUCCESS in case of success, negative error otherwise

Definition at line 515 of file ad5770r_console_app.c.