Example program for AD717x and AD411x family of products.

Dependencies:   adi_console_menu platform_drivers

Embed: (wiki syntax)

« Back to documentation index

ad717x_console_app.c File Reference

ad717x_console_app.c File Reference

: Implementation of the menu functions which handles the functionality of AD717x and AD411x family of devices. More...

Go to the source code of this file.

Functions

static bool was_escape_key_pressed (void)
 determines if the Escape key was pressed
int32_t ad717x_app_initialize (void)
 Initialize the AD717x device and associated low level peripherals.
void display_main_menu_header (void)
 Display the header info for main menu.
int32_t menu_read_id (uint32_t menu_id)
 Handle the menu to read device ID.
int32_t menu_read_status (uint32_t menu_id)
 Handle the menu to read device status register.
static void dislay_channel_samples (bool showOnlyEnabledChannels, uint8_t console_mode)
 displays the current sample value for a ADC channels
static void clear_channel_samples (void)
 resets the channelSampleCounts to zero
static int32_t do_continuous_conversion (uint8_t display_mode)
 Continuously acquires samples in Continuous Conversion mode.
int32_t menu_continuous_conversion_tabular (uint32_t channel_id)
 Samples all enabled channels and displays in tabular form.
int32_t menu_continuous_conversion_stream (uint32_t channel_id)
 Samples all enabled channels and displays on the console.
int32_t menu_single_conversion (uint32_t channel_id)
 Samples all enabled channels once in Single Conversion mode.
int32_t menu_sample_channels (uint32_t menu_id)
 Handle the menu to sample the channels.
int32_t menu_chn_enable_disable_display (uint32_t menu_id)
 Display the menu to enable/disable channel selection.
int32_t menu_analog_input_connect (uint32_t user_analog_input)
 Handle the menu to connect input to channel.
int32_t menu_input_chn_connect_display (uint32_t menu_id)
 Display the menu selections to connect analog input pins to a channel.
int32_t menu_filter_select (uint32_t user_input_filter_type)
 Handle the menu to select the filter type.
int32_t menu_postfiler_enable_disable (uint32_t user_action)
 Handle the menu to enable/disable the post filter.
int32_t menu_postfiler_select (uint32_t user_input_post_filter_type)
 Handle the menu to select the post filter.
int32_t menu_odr_select (uint32_t user_input_odr_val)
 Handle the menu to select the ODR value.
int32_t menu_polarity_select (uint32_t user_input_polarity)
 Handle the menu to select the polarity.
int32_t menu_reference_source_select (uint32_t user_input_reference)
 Handle the menu to select the reference source.
int32_t menu_ref_buffer_enable_disable (uint32_t user_action)
 Handle the menu to enable/disable the reference buffers.
int32_t menu_input_buffer_enable_disable (uint32_t user_action)
 Handle the menu to enable/disable the input buffers.
int32_t menu_config_and_assign_setup (uint32_t menu_id)
 Handle the menu to configure and assign the device setup.
int32_t menu_display_setup (uint32_t menu_id)
 Handle the menu to display device setup.
int32_t menu_read_temperature (uint32_t menu_id)
 Handle the menu to read die temperature of device.
int32_t menu_calibrate_adc (uint32_t menu_id)
 Handle the menu to calibrate the device.
int32_t menu_input_type_selection (uint32_t user_input_type)
 Handle the menu to select input type for open wire detection.
int32_t menu_select_chn_pair (uint32_t user_channel_pair)
 Handle the menu to select channel pair for open wire detection.
int32_t menu_select_input_pair (uint32_t user_analog_input)
 Handle the menu to select input pair for open wire detection.
int32_t menu_open_wire_detection (uint32_t menu_id)
 Handle the menu to perform open wire detection.
int32_t menu_read_write_device_regs (uint32_t menu_id)
 Handle the menu to read/write device registers.

Detailed Description

: Implementation of the menu functions which handles the functionality of AD717x and AD411x family of devices.

: This file is specific to AD717x/AD411x 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 ad717x_console_app.c.


Function Documentation

int32_t ad717x_app_initialize ( void   )

Initialize the AD717x device and associated low level peripherals.

Returns:
SUCCESS(0) Or FAILURE(negative)

Definition at line 135 of file ad717x_console_app.c.

static void clear_channel_samples ( void   ) [static]

resets the channelSampleCounts to zero

Definition at line 487 of file ad717x_console_app.c.

static void dislay_channel_samples ( bool  showOnlyEnabledChannels,
uint8_t  console_mode 
) [static]

displays the current sample value for a ADC channels

Parameters:
showOnlyEnabledChannelsonly channels that are enabled are displayed

Definition at line 425 of file ad717x_console_app.c.

void display_main_menu_header ( void   )

Display the header info for main menu.

Returns:
None

Definition at line 293 of file ad717x_console_app.c.

static int32_t do_continuous_conversion ( uint8_t  display_mode ) [static]

Continuously acquires samples in Continuous Conversion mode.

The ADC is run in continuous mode, and all samples are acquired and assigned to the channel they come from. Escape key an be used to exit the loop

Definition at line 503 of file ad717x_console_app.c.

int32_t menu_analog_input_connect ( uint32_t  user_analog_input )

Handle the menu to connect input to channel.

Parameters:
analoginput to be connected
Returns:
MENU_CONTINUE

Definition at line 856 of file ad717x_console_app.c.

int32_t menu_calibrate_adc ( uint32_t  menu_id )

Handle the menu to calibrate the device.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 1610 of file ad717x_console_app.c.

int32_t menu_chn_enable_disable_display ( uint32_t  menu_id )

Display the menu to enable/disable channel selection.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 845 of file ad717x_console_app.c.

int32_t menu_config_and_assign_setup ( uint32_t  menu_id )

Handle the menu to configure and assign the device setup.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 1219 of file ad717x_console_app.c.

int32_t menu_continuous_conversion_stream ( uint32_t  channel_id )

Samples all enabled channels and displays on the console.

Definition at line 635 of file ad717x_console_app.c.

int32_t menu_continuous_conversion_tabular ( uint32_t  channel_id )

Samples all enabled channels and displays in tabular form.

Definition at line 617 of file ad717x_console_app.c.

int32_t menu_display_setup ( uint32_t  menu_id )

Handle the menu to display device setup.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 1315 of file ad717x_console_app.c.

int32_t menu_filter_select ( uint32_t  user_input_filter_type )

Handle the menu to select the filter type.

Parameters:
userselected filter type
Returns:
MENU_DONE

Definition at line 945 of file ad717x_console_app.c.

int32_t menu_input_buffer_enable_disable ( uint32_t  user_action )

Handle the menu to enable/disable the input buffers.

Parameters:
userselected action
Returns:
MENU_DONE

Definition at line 1182 of file ad717x_console_app.c.

int32_t menu_input_chn_connect_display ( uint32_t  menu_id )

Display the menu selections to connect analog input pins to a channel.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 922 of file ad717x_console_app.c.

int32_t menu_input_type_selection ( uint32_t  user_input_type )

Handle the menu to select input type for open wire detection.

Parameters:
Userselected analog input type
Returns:
MENU_DONE

Definition at line 1726 of file ad717x_console_app.c.

int32_t menu_odr_select ( uint32_t  user_input_odr_val )

Handle the menu to select the ODR value.

Parameters:
userselected ODR
Returns:
MENU_DONE

Definition at line 1040 of file ad717x_console_app.c.

int32_t menu_open_wire_detection ( uint32_t  menu_id )

Handle the menu to perform open wire detection.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 1840 of file ad717x_console_app.c.

int32_t menu_polarity_select ( uint32_t  user_input_polarity )

Handle the menu to select the polarity.

Parameters:
userselected polarity
Returns:
MENU_DONE

Definition at line 1069 of file ad717x_console_app.c.

int32_t menu_postfiler_enable_disable ( uint32_t  user_action )

Handle the menu to enable/disable the post filter.

Parameters:
userselected action
Returns:
MENU_DONE

Definition at line 980 of file ad717x_console_app.c.

int32_t menu_postfiler_select ( uint32_t  user_input_post_filter_type )

Handle the menu to select the post filter.

Parameters:
userselected post filter type
Returns:
MENU_DONE

Definition at line 1011 of file ad717x_console_app.c.

int32_t menu_read_id ( uint32_t  menu_id )

Handle the menu to read device ID.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 305 of file ad717x_console_app.c.

int32_t menu_read_status ( uint32_t  menu_id )

Handle the menu to read device status register.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 330 of file ad717x_console_app.c.

int32_t menu_read_temperature ( uint32_t  menu_id )

Handle the menu to read die temperature of device.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 1455 of file ad717x_console_app.c.

int32_t menu_read_write_device_regs ( uint32_t  menu_id )

Handle the menu to read/write device registers.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 2016 of file ad717x_console_app.c.

int32_t menu_ref_buffer_enable_disable ( uint32_t  user_action )

Handle the menu to enable/disable the reference buffers.

Parameters:
userselected action
Returns:
MENU_DONE

Definition at line 1145 of file ad717x_console_app.c.

int32_t menu_reference_source_select ( uint32_t  user_input_reference )

Handle the menu to select the reference source.

Parameters:
userselected reference source
Returns:
MENU_DONE

Definition at line 1100 of file ad717x_console_app.c.

int32_t menu_sample_channels ( uint32_t  menu_id )

Handle the menu to sample the channels.

Parameters:
menu_id-(Optional parameter)
Returns:
MENU_CONTINUE

Definition at line 784 of file ad717x_console_app.c.

int32_t menu_select_chn_pair ( uint32_t  user_channel_pair )

Handle the menu to select channel pair for open wire detection.

Parameters:
Userselected channel pair
Returns:
MENU_DONE

Definition at line 1740 of file ad717x_console_app.c.

int32_t menu_select_input_pair ( uint32_t  user_analog_input )

Handle the menu to select input pair for open wire detection.

Parameters:
Userselected analog input
Returns:
MENU_DONE

Definition at line 1754 of file ad717x_console_app.c.

int32_t menu_single_conversion ( uint32_t  channel_id )

Samples all enabled channels once in Single Conversion mode.

This stores all channels that are enabled in a bitmask, and then runs the ADC in single conversion mode, which acquires one channel of data at a time. After capture, that channel is disabled, and single conversion run again, until no channels are enabled. The original enable state of each channel is then restored.

Definition at line 654 of file ad717x_console_app.c.

static bool was_escape_key_pressed ( void   ) [static]

determines if the Escape key was pressed

Returns:
key press status

Definition at line 166 of file ad717x_console_app.c.