This is an forked repository to push changes related to no-OS repository adoption
Dependencies: adi_console_menu platform_drivers
Diff: app/ad717x_console_app.c
- Revision:
- 4:4592cc69bfa6
- Parent:
- 3:6c7324997606
- Child:
- 8:13ddfedfe923
--- a/app/ad717x_console_app.c Tue Apr 14 18:14:29 2020 +0000 +++ b/app/ad717x_console_app.c Mon Aug 03 15:02:37 2020 +0530 @@ -43,7 +43,8 @@ // Include the device register address map headers and device register map based // on the user selected device (default is AD4111) -#if defined(DEV_AD4111) || defined(DEV_AD4112) +#if defined(DEV_AD4111) || defined(DEV_AD4112) || defined(DEV_AD4114) || \ + defined(DEV_AD4115) #include <ad411x_regs.h> static ad717x_st_reg *ad717x_device_map = ad4111_regs; static uint8_t ad717x_reg_count = sizeof(ad4111_regs) / sizeof(ad4111_regs[0]); @@ -145,7 +146,7 @@ // spi_init_param type { 2500000, // Max SPI Speed - SPI_SS_A, // Chip Select pin + SPI_SS, // Chip Select pin SPI_MODE_3, // CPOL = 1, CPHA =1 &spi_init_extra_params, // SPI extra configurations }, @@ -262,7 +263,7 @@ /* @brief Select adc channel to be assigned to setup * @return none **/ -static void select_chn_assignment(void) +static char select_chn_assignment(void) { bool current_selection_done = false; char rx_char; @@ -280,6 +281,8 @@ printf(EOL "\tInvalid entry!!"); } } while (current_selection_done == false); + + return rx_char; } @@ -875,7 +878,8 @@ device_chnmap_reg = AD717X_GetReg(pad717x_dev, AD717X_CHMAP0_REG + current_channel); -#if defined(DEV_AD4111) || defined(DEV_AD4112) +#if defined(DEV_AD4111) || defined(DEV_AD4112) || defined(DEV_AD4114) || \ + defined(DEV_AD4115) // Select analog input pair device_chnmap_reg->value = ((device_chnmap_reg->value & ~AD4111_CHMAP_REG_INPUT_MSK) | @@ -917,7 +921,8 @@ */ int32_t menu_input_chn_connect_display(uint32_t menu_id) { -#if defined(DEV_AD4111) || defined(DEV_AD4112) +#if defined(DEV_AD4111) || defined(DEV_AD4112) || defined(DEV_AD4114) || \ + defined(DEV_AD4115) input_to_select = ANALOG_INP_PAIR_SELECT; adi_do_console_menu(&analog_input_connect_menu); #else @@ -1214,6 +1219,7 @@ int32_t menu_config_and_assign_setup(uint32_t menu_id) { float filter_odr; // filter ODR value + char rx_char; adi_clear_console(); @@ -1272,8 +1278,11 @@ enable_disable_status[device_setup.input_buffers]); printf(EOL); - // Select and assign the channel - select_chn_assignment(); + /* Allow user to assign setup to multiple channels*/ + do { + // Select and assign the channel + rx_char = select_chn_assignment(); + } while (rx_char != 'N'); return MENU_CONTINUE; } @@ -1387,7 +1396,8 @@ break; } -#if defined(DEV_AD4111) || defined(DEV_AD4112) +#if defined(DEV_AD4111) || defined(DEV_AD4112) || defined(DEV_AD4114) || \ + defined(DEV_AD4115) device_setup.input_buffers = AD4111_SETUP_CONF_REG_AIN_BUF_RD(device_setupcon_reg->value); device_setup.reference_buffers =