Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: platform_drivers
ad4696_support.c
00001 /*************************************************************************//** 00002 * @file ad4696_support.c 00003 * @brief AD469x device No-OS driver supports 00004 ****************************************************************************** 00005 * Copyright (c) 2021 Analog Devices, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * This software is proprietary to Analog Devices, Inc. and its licensors. 00010 * By using this software you agree to the terms of the associated 00011 * Analog Devices Software License Agreement. 00012 *****************************************************************************/ 00013 00014 /******************************************************************************/ 00015 /***************************** Include Files **********************************/ 00016 /******************************************************************************/ 00017 00018 #include <stdint.h> 00019 00020 #include "app_config.h" 00021 #include "ad4696_support.h" 00022 #include "error.h" 00023 00024 /******************************************************************************/ 00025 /********************** Macros and Constants Definition ***********************/ 00026 /******************************************************************************/ 00027 00028 /******************************************************************************/ 00029 /********************** Variables and User Defined Data Types *****************/ 00030 /******************************************************************************/ 00031 00032 /******************************************************************************/ 00033 /************************ Functions Definitions *******************************/ 00034 /******************************************************************************/ 00035 /*! 00036 * @brief Enter Manual Trigger mode 00037 * @param device[in] - device instance 00038 * @return SUCCESS in case of success, negative error code otherwise. 00039 */ 00040 int32_t ad4696_enable_manual_trigger_mode(struct ad469x_dev *device) 00041 { 00042 do 00043 { 00044 if (ad469x_spi_reg_write(device, 00045 AD469x_REG_SETUP, 00046 AD469x_REG_SETUP_RESET) != SUCCESS) { 00047 break; 00048 } 00049 00050 if (ad469x_spi_reg_write(device, 00051 AD469x_REG_SEQ_CTRL, 00052 AD469x_REG_SEQ_CTRL_RESET) != SUCCESS) { 00053 break; 00054 } 00055 00056 return SUCCESS; 00057 } while (0); 00058 00059 return FAILURE; 00060 } 00061 00062 /*! 00063 * @brief Select between polarity modes 00064 * @param device[in] - device instance 00065 * @return SUCCESS in case of success, negative error code otherwise. 00066 */ 00067 int32_t ad4696_polarity_mode_select(struct ad469x_dev *device) 00068 { 00069 uint8_t data = 0; 00070 00071 for (uint8_t i = 0; i < AD469x_CHANNEL_NO;i++) 00072 { 00073 if (ad469x_spi_reg_read(device, 00074 AD469x_REG_CONFIG_IN(i), 00075 &data) != SUCCESS) { 00076 return FAILURE; 00077 } 00078 00079 #if defined(PSEUDO_BIPOLAR_MODE) 00080 data |= (AD469x_REG_CONFIG_IN_PAIR(AD469x_PSEUDO_BIPOLAR_MODE) 00081 | AD469x_REG_CONFIG_IN_MODE(AD469x_INx_COM)); 00082 #else 00083 data |= (AD469x_REG_CONFIG_IN_PAIR(AD469x_UNIPOLAR_MODE) 00084 | AD469x_REG_CONFIG_IN_MODE(AD469x_INx_REF_GND)); 00085 #endif 00086 00087 if (ad469x_spi_reg_write(device, 00088 AD469x_REG_CONFIG_IN(i), 00089 data) != SUCCESS) { 00090 return FAILURE; 00091 } 00092 } 00093 return SUCCESS; 00094 }
Generated on Thu Jul 21 2022 03:20:48 by
1.7.2