Analog Devices / Mbed OS EVAL-AD5592R

Dependencies:   adi_console_menu platform_drivers

Embed: (wiki syntax)

« Back to documentation index

ad5592r_console_app.c File Reference

ad5592r_console_app.c File Reference

AD5592R console application interfaces. More...

Go to the source code of this file.

Functions

static int32_t do_software_reset (uint32_t id)
 Performs software reset.
static int32_t do_read_die_temp (uint32_t id)
 Prints the temperature of the die.
static float die_temp_calculation (uint16_t adc_temp_code, bool adc_gain)
 Calculates the die temperature.
static void do_set_channel_modes (void)
 Set channel modes.
static int32_t do_toggle_channel_selection (uint32_t channel)
 Toggle channels currently selected.
static int32_t do_mode_selection (uint32_t mode)
 Mode selection.
static int32_t do_reset_channel_modes (uint32_t id)
 Reset Channel Modes.
static int32_t do_offstate_selection (uint32_t mode)
 Offstate selection.
static int32_t do_channel_7_adc_indicator (uint32_t id)
 Sets Channel 7 as ADC conversion indicator.
static int32_t do_general_settings_toggle (uint32_t reg_bit_id)
 Toggle general setting.
static int32_t do_write_dac_value (uint32_t id)
 Write DAC Values.
static int32_t do_dac_input_reg_to_output (uint32_t id)
 DAC input register to DAC output.
static int32_t do_toggle_ldac_mode (uint32_t id)
 Toggle LDAC Modes.
static int32_t do_toggle_dac_powerdown (uint32_t id)
 Toggle DAC channels to power-down.
static int32_t do_toggle_incl_in_seq (uint32_t id)
 Toggle Channels to include in ADC Sequence.
static int32_t do_read_adc_sequence (uint32_t id)
 Read ADC Sequence.
int32_t ad5592r_app_initalization (void)
 Initialize AD5592/3R. ACTIVE_DEVICE defined in app_config.h.
static void display_general_setting_header (void)
 displays the general settings header
static uint16_t user_dac_code (float user_voltage)
 User dac code.
static float code_to_volts (int16_t code)
 Code values to voltage.
static int32_t do_set_gpio_input (uint32_t id)
 Set GPI.
static int32_t do_set_gpio_output (uint32_t value)
 Set GPO.
static int32_t do_toggle_gpio_output (uint32_t id)
 Toggle GPO.
static int32_t menu_general_settings (uint32_t id)
 calls the general configuration menu
static int32_t menu_dac (uint32_t id)
 calls the DAC configuration menu
static int32_t menu_config_channels (uint32_t id)
 calls the channel configuration menu
static int32_t menu_adc (uint32_t id)
 calls the ADC configuration menu
static int32_t menu_gpio (uint32_t id)
 calls the menu to select GPIO pins to toggle
static void display_channel_selection_header (void)
 displays the channel configuration header
static void display_gpio_menu_header (void)
 displays the gpio menu header
static void display_dac_menu_header (void)
 displays the DAC menu header
static void display_main_menu_header (void)
 displays the Main menu header
static void display_adc_menu_header (void)
 displays the ADC menu header

Detailed Description

AD5592R console application interfaces.

This file is specific to ad5592r and ad5593r console menu application handle. The functions defined in this file performs the action based on user selected console menu.

----------------------------------------------------------------------------- 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 ad5592r_console_app.c.


Function Documentation

int32_t ad5592r_app_initalization ( void   )

Initialize AD5592/3R. ACTIVE_DEVICE defined in app_config.h.

The device initialization varies depending on what ACTIVE_DEVICE is defined. Device is reset and default register map values written. SPI or I2C initialization occurs.

Returns:
SUCCESS (0), FAILURE (negative)

Definition at line 132 of file ad5592r_console_app.c.

static float code_to_volts ( int16_t  code ) [static]

Code values to voltage.

Generate voltage based on code value

Parameters:
code- integer value used to generate voltage value
Returns:
float voltage value

Definition at line 485 of file ad5592r_console_app.c.

static float die_temp_calculation ( uint16_t  adc_temp_code,
bool  adc_gain 
) [static]

Calculates the die temperature.

Based on conversion equation, die temperature is estimated

Parameters:
adc_temp_code- data read from ADC readback frame adc_gain - status of adc_gain
Returns:
result

Definition at line 244 of file ad5592r_console_app.c.

static void display_adc_menu_header ( void   ) [static]

displays the ADC menu header

Definition at line 853 of file ad5592r_console_app.c.

static void display_channel_selection_header ( void   ) [static]

displays the channel configuration header

Definition at line 751 of file ad5592r_console_app.c.

static void display_dac_menu_header ( void   ) [static]

displays the DAC menu header

Definition at line 789 of file ad5592r_console_app.c.

static void display_general_setting_header ( void   ) [static]

displays the general settings header

Definition at line 409 of file ad5592r_console_app.c.

static void display_gpio_menu_header ( void   ) [static]

displays the gpio menu header

Definition at line 770 of file ad5592r_console_app.c.

static void display_main_menu_header ( void   ) [static]

displays the Main menu header

Definition at line 839 of file ad5592r_console_app.c.

static int32_t do_channel_7_adc_indicator ( uint32_t  id ) [static]

Sets Channel 7 as ADC conversion indicator.

Channel 7 is set as a GPIO and the NOT BUSY bit is set in the GPIO write configuration register enabling channel 7 to be used as an indicator when ADC conversion are occurring. Channel 7 will go LOW when a conversion is occurring. ***NOTE*** After selecting this Channel 7 will appear as GPO. ***NOTE*** Ensure this is the last channel to be configured in order to ensure preference will no be overwritten

Returns:
(MENU_CONTINUE)

Definition at line 362 of file ad5592r_console_app.c.

static int32_t do_dac_input_reg_to_output ( uint32_t  id ) [static]

DAC input register to DAC output.

Writes the data from the DAC input register to the DAC output. The LDAC mode is returned to write data to the input register only.

Returns:
(MENU_CONTINUE)

Definition at line 456 of file ad5592r_console_app.c.

static int32_t do_general_settings_toggle ( uint32_t  reg_bit_id ) [static]

Toggle general setting.

Setting (reg_bit) in register (reg) is toggled

Parameters:
reg_bit_id- Combined value containing register address and bit to toggle
Returns:
(MENU_CONTINUE)

Definition at line 380 of file ad5592r_console_app.c.

static int32_t do_mode_selection ( uint32_t  mode ) [static]

Mode selection.

The mode the users wishes to apply to the currently selected channels are selected here. do_set_channel_modes is called which sets the channels on the device.

Parameters:
mode-The mode that the user wishes to apply to the selected channels
Returns:
(MENU_CONTINUE)

Definition at line 306 of file ad5592r_console_app.c.

static int32_t do_offstate_selection ( uint32_t  mode ) [static]

Offstate selection.

The offstate the users wishes to apply to the currently selected channels are selected here. do_set_channel_modes is called which sets the channels on the device.

Parameters:
Theoffstate that the user wishes to apply to the selected channels
Returns:
(MENU_CONTINUE)

Definition at line 326 of file ad5592r_console_app.c.

int32_t do_read_adc_sequence ( uint32_t  id ) [static]

Read ADC Sequence.

The channels that are included in an ADC conversion sequence are read. For the number of channels in the sequence, the data is parsed, converted and printed.

Returns:
SUCCESS OR FAILURE

Definition at line 587 of file ad5592r_console_app.c.

static int32_t do_read_die_temp ( uint32_t  id ) [static]

Prints the temperature of the die.

Sets the devices to perform a temperature readback. Performs a number of samples based on TEMP_SAMPLE_SIZE

Returns:
MENU_CONTINUE

Definition at line 193 of file ad5592r_console_app.c.

static int32_t do_reset_channel_modes ( uint32_t  id ) [static]

Reset Channel Modes.

This resets all channel modes to unused.

Returns:
(MENU_CONTINUE)

Definition at line 344 of file ad5592r_console_app.c.

static void do_set_channel_modes ( void   ) [static]

Set channel modes.

The channels modes are set by passing the altered device struct into the ad5592r_set_channel_modes function. There the channels are set to desired modes.

Definition at line 268 of file ad5592r_console_app.c.

static int32_t do_set_gpio_input ( uint32_t  id ) [static]

Set GPI.

GPIO channels that are selected, with the selection being stored in active_channel_selections array are set to GPIO Inputs. The selection is then cleared.

Returns:
(MENU_CONTINUE)

Definition at line 639 of file ad5592r_console_app.c.

static int32_t do_set_gpio_output ( uint32_t  value ) [static]

Set GPO.

GPIO channels that are selected, with the selection being stored in active_channel_selections array are set to GPIO Outputs with their output set LOW. The selection is then cleared.

Returns:
(MENU_CONTINUE)

Definition at line 664 of file ad5592r_console_app.c.

static int32_t do_software_reset ( uint32_t  id ) [static]

Performs software reset.

Writes to the reset register. Resets sAd5592r_dev configuration using configuration from ad5592r_reset_config.c SPI, I2C and ops are stored and restored after the reset.

Returns:
MENU_CONTINUE

Definition at line 155 of file ad5592r_console_app.c.

static int32_t do_toggle_channel_selection ( uint32_t  channel ) [static]

Toggle channels currently selected.

The channels the user has currently selected are set here. These are the channels that will be altered by mode or offstate selection

Parameters:
channel- A channel that the user wants to add to the currently selected channels
Returns:
(MENU_CONTINUE)

Definition at line 284 of file ad5592r_console_app.c.

static int32_t do_toggle_dac_powerdown ( uint32_t  id ) [static]

Toggle DAC channels to power-down.

Toggles DAC channels that are powered down based on user selection

Returns:
(MENU_CONTINUE)

Definition at line 539 of file ad5592r_console_app.c.

static int32_t do_toggle_gpio_output ( uint32_t  id ) [static]

Toggle GPO.

GPIO channels that are selected, with the selection being stored in active_channel_selections array are set to GPIO Outputs with their output set toggled HIGH and LOW. The selection is then cleared.

Returns:
(MENU_CONTINUE)

Definition at line 689 of file ad5592r_console_app.c.

static int32_t do_toggle_incl_in_seq ( uint32_t  id ) [static]

Toggle Channels to include in ADC Sequence.

Toggles channels that are included in the ADC conversion sequence

Returns:
MENU_CONTINUE

Definition at line 570 of file ad5592r_console_app.c.

static int32_t do_toggle_ldac_mode ( uint32_t  id ) [static]

Toggle LDAC Modes.

Toggles the LDAC mode variable between Immediate write to output and write values to input register

Returns:
(MENU_CONTINUE)

Definition at line 524 of file ad5592r_console_app.c.

static int32_t do_write_dac_value ( uint32_t  id ) [static]

Write DAC Values.

Write value specified by user to Channels selected by user in the DAC menu

Returns:
(MENU_CONTINUE)

Definition at line 495 of file ad5592r_console_app.c.

static int32_t menu_adc ( uint32_t  id ) [static]

calls the ADC configuration menu

Definition at line 735 of file ad5592r_console_app.c.

static int32_t menu_config_channels ( uint32_t  id ) [static]

calls the channel configuration menu

Definition at line 727 of file ad5592r_console_app.c.

static int32_t menu_dac ( uint32_t  id ) [static]

calls the DAC configuration menu

Definition at line 719 of file ad5592r_console_app.c.

static int32_t menu_general_settings ( uint32_t  id ) [static]

calls the general configuration menu

Definition at line 711 of file ad5592r_console_app.c.

static int32_t menu_gpio ( uint32_t  id ) [static]

calls the menu to select GPIO pins to toggle

Definition at line 743 of file ad5592r_console_app.c.

static uint16_t user_dac_code ( float  user_voltage ) [static]

User dac code.

Generate dac code that can be written to device from voltage provided by user

Parameters:
user_voltage- float value provided by user for voltage value to be set
Returns:
dac code value

Definition at line 474 of file ad5592r_console_app.c.