Example program for EVAL-AD4696.

Dependencies:   platform_drivers

Files at this revision

API Documentation at this revision

Comitter:
Kjansen
Date:
Thu Sep 30 11:58:20 2021 +0100
Parent:
0:721af8bb4b69
Commit message:
AD4696 IIO Application- Initial Revision

Changed in this revision

AD4696.lib Show diff for this revision Revisions of this file
LICENSE.md Show diff for this revision Revisions of this file
License.txt Show annotated file Show diff for this revision Revisions of this file
README.txt Show annotated file Show diff for this revision Revisions of this file
app/.mbedignore Show annotated file Show diff for this revision Revisions of this file
app/ad4696_data_capture.c Show annotated file Show diff for this revision Revisions of this file
app/ad4696_data_capture.h Show annotated file Show diff for this revision Revisions of this file
app/ad4696_support.c Show annotated file Show diff for this revision Revisions of this file
app/ad4696_support.h Show annotated file Show diff for this revision Revisions of this file
app/ad4696_user_config.c Show annotated file Show diff for this revision Revisions of this file
app/ad4696_user_config.h Show annotated file Show diff for this revision Revisions of this file
app/ad469x.c Show annotated file Show diff for this revision Revisions of this file
app/ad469x.h Show annotated file Show diff for this revision Revisions of this file
app/app_config.c Show annotated file Show diff for this revision Revisions of this file
app/app_config.h Show annotated file Show diff for this revision Revisions of this file
app/app_config_mbed.c Show annotated file Show diff for this revision Revisions of this file
app/app_config_mbed.h Show annotated file Show diff for this revision Revisions of this file
app/iio_ad4696.c Show annotated file Show diff for this revision Revisions of this file
app/iio_ad4696.h Show annotated file Show diff for this revision Revisions of this file
app/libtinyiiod.lib Show annotated file Show diff for this revision Revisions of this file
app/main.c Show annotated file Show diff for this revision Revisions of this file
app/mbed_platform_drivers.lib Show annotated file Show diff for this revision Revisions of this file
app/no-OS.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
--- a/AD4696.lib	Wed Sep 29 11:39:40 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://os.mbed.com/teams/AnalogDevices/code/AD4696/#6dad33aec469
--- a/LICENSE.md	Wed Sep 29 11:39:40 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-Analog Devices, Inc. (ADI)
-Source Code Software License Agreement
-20210129-LWSCMOS-CTSLA
-BEFORE YOU SELECT THE "I ACCEPT" BUTTON AT THE BOTTOM OF THIS WINDOW, CAREFULLY READ THE TERMS AND CONDITIONS SET FORTH BELOW.  BY SELECTING THE "I ACCEPT" BUTTON BELOW, OR DOWNLOADING, REPRODUCING, DISTRIBUTING OR OTHERWISE USING THE SOFTWARE, YOU AGREE TO BE BOUND BY THE TERMS AND CONDITIONS SET FORTH BELOW.  IF YOU DO NOT AGREE TO ALL OF THE TERMS AND CONDITIONS, SELECT THE 'I DO NOT ACCEPT' BUTTON AND YOU MUST NOT DOWNLOAD, INSTALL OR OTHERWISE USE THE SOFTWARE.
-
-DOWNLOADING, REPRODUCING, DISTRIBUTING OR OTHERWISE USING THE SOFTWARE CONSTITUTES ACCEPTANCE OF THIS LICENSE.  THE SOFTWARE MAY NOT BE USED EXCEPT AS EXPRESSLY AUTHORIZED UNDER THIS LICENSE. 
-
-The software is protected by copyright law and international copyright treaties.  
-
-1. License:  Subject to the terms and conditions of this license, the software may be reproduced, modified and distributed in source code and object code form.
-
-2. Conditions: 
-(a) Any distribution of the software must include a complete copy of this license and retain all copyright and other proprietary notices.  The software that is distributed (including modified versions of the software) shall be subject to the terms and conditions of this license.  
-(b) The software may not be combined or merged with other software in any manner that would cause the software to become subject to terms and conditions which differ from those of this license.
-(c) The software is licensed solely and exclusively for use with processors / products manufactured by or for ADI.
-(d) Licensee shall not use the name or any trademark of ADI (including those of its licensors) or any contributor to endorse or promote products without prior written consent of the owner of the name or trademark.  The term �contributor� means any person or entity that modifies or distributes the software.  
-(e) Modified versions of the Software must be conspicuously marked as such.
-(f) Use of the software may or may not infringe patent rights of one or more patent holders.  This license does not alleviate the obligation to obtain separate licenses from patent holders to use the software.
-(g) All rights not expressly granted hereunder are reserved.  
-(h) This license shall be governed by the laws of Massachusetts, without regard to its conflict of laws rules.  The software shall only be used in compliance with all applicable laws and regulations, including without limitation export control laws.  
-
-3. WARRANTY DISCLAIMER: THE SOFTWARE AND ANY RELATED INFORMATION AND/OR ADVICE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT REPRESENTATIONS, GUARANTEES OR WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, ORAL OR WRITTEN, INCLUDING WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. There is no obligation to provide software support or updates.  The Software is not fault-tolerant and is not intended for use in high risk applications, including without limitation in the operation of nuclear facilities, aircraft navigation or control systems, air traffic control, life support machines, weapons systems, autonomous driving or other safety critical automotive applications, or any other application in which the failure of the software could lead to death, personal injury, or severe physical or environmental damages.  The software is not authorized to be used under such circumstances.
-
-4. LIMITATION OF LIABILITY: TO THE MAXIMUM EXTENT PERMITTED BY LAW ADI (INCLUDING ITS LICENSORS) AND CONTRIBUTORS SHALL NOT BE LIABLE FOR ANY DAMAGES ARISING FROM OR RELATED TO THE SOFTWARE, ITS USE OR ANY RELATED INFORMATION AND/OR SERVICES, INCLUDING BUT NOT LIMITED TO ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE, EXEMPLARY, CONSEQUENTIAL OR ANALOGOUS DAMAGES (INCLUDING WITHOUT LIMITATION ANY DAMAGES RESULTING FROM LOSS OF USE, DATA, REVENUE, PROFITS, OR SAVINGS, COMPUTER DAMAGE OR ANY OTHER CAUSE), UNDER ANY LEGAL THEORY (INCLUDING WITHOUT LIMITATION CONTRACT, WARRANTY, TORT, NEGLIGENCE, STRICT OR PRODUCT LIABILITY), EVEN IF IT HAS BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES.  Some jurisdictions do not permit the exclusion or limitation of liability for consequential, incidental or other damages, and, as such, some portion of the above limitation may not apply.  In such jurisdictions, liability is limited to the greatest extent permitted by law.
-5.  Third Party Software:  The software may be accompanied by or include software made available by one or more third parties (Third Party Software).  Each portion of Third Party Software is subject to its own separate software license terms and conditions (�Third Party Licenses�).  The Third Party Licenses for Third Party Software delivered with the software are set forth or identified (by url or otherwise) in (i) Appendix A to this license (if any), (ii) the applicable software header or footer text, (iii) a text file located in the directory of the applicable Third Party Software component and/or (iv) such other location customarily used for licensing terms. The use of each portion of Third Party Software is subject to the Third Party Licenses, and you agree that your use of any Third Party Software is bound by the applicable Third Party License.  You agree to review and comply with all applicable Third Party Licenses prior to any use or distribution of any Third Party Software.  Third Party Software is provided on an �as is� basis without any representation, warranty or liability of any kind.  ADI (including its licensors) and contributors shall have no liability or responsibility for the operation or performance of the Third Party Software and shall not be liable for any damages, costs, or expenses, direct or indirect, arising out of the performance or failure to perform of the Third Party Software.  ADI (including its licensors) and contributors shall be entitled to the benefit of any and all limitations of liability and disclaimers of warranties contained in the Third Party Licenses. For the avoidance of doubt, this license does not alter, limit or expand the terms and conditions of, or rights granted to you pursuant to, Third Party Licenses.  
- 
-Appendix A - Third Party License
-
-Mbed-OS
-
-Download page:https://github.com/ARMmbed/mbed-os/
-Online license: 	https://github.com/ARMmbed/mbed-os/blob/master/LICENSE-apache-2.0.txt
-
-
-Apache License 2.0
-
-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
-"License" shall mean the terms and conditions for use, reproduction, and
-distribution as defined by Sections 1 through 9 of this document.
-
-"Licensor" shall mean the copyright owner or entity authorized by the copyright
-owner that is granting the License.
-
-"Legal Entity" shall mean the union of the acting entity and all other entities
-that control, are controlled by, or are under common control with that entity.
-For the purposes of this definition, "control" means (i) the power, direct or
-indirect, to cause the direction or management of such entity, whether by
-contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
-outstanding shares, or (iii) beneficial ownership of such entity.
-
-"You" (or "Your") shall mean an individual or Legal Entity exercising
-permissions granted by this License.
-
-"Source" form shall mean the preferred form for making modifications, including
-but not limited to software source code, documentation source, and configuration
-files.
-
-"Object" form shall mean any form resulting from mechanical transformation or
-translation of a Source form, including but not limited to compiled object code,
-generated documentation, and conversions to other media types.
-
-"Work" shall mean the work of authorship, whether in Source or Object form, made
-available under the License, as indicated by a copyright notice that is included
-in or attached to the work (an example is provided in the Appendix below).
-
-"Derivative Works" shall mean any work, whether in Source or Object form, that
-is based on (or derived from) the Work and for which the editorial revisions,
-annotations, elaborations, or other modifications represent, as a whole, an
-original work of authorship. For the purposes of this License, Derivative Works
-shall not include works that remain separable from, or merely link (or bind by
-name) to the interfaces of, the Work and Derivative Works thereof.
-
-"Contribution" shall mean any work of authorship, including the original version
-of the Work and any modifications or additions to that Work or Derivative Works
-thereof, that is intentionally submitted to Licensor for inclusion in the Work
-by the copyright owner or by an individual or Legal Entity authorized to submit
-on behalf of the copyright owner. For the purposes of this definition,
-"submitted" means any form of electronic, verbal, or written communication sent
-to the Licensor or its representatives, including but not limited to
-communication on electronic mailing lists, source code control systems, and
-issue tracking systems that are managed by, or on behalf of, the Licensor for
-the purpose of discussing and improving the Work, but excluding communication
-that is conspicuously marked or otherwise designated in writing by the copyright
-owner as "Not a Contribution."
-
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
-of whom a Contribution has been received by Licensor and subsequently
-incorporated within the Work.
-
-2. Grant of Copyright License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable copyright license to reproduce, prepare Derivative Works of,
-publicly display, publicly perform, sublicense, and distribute the Work and such
-Derivative Works in Source or Object form.
-
-3. Grant of Patent License.
-
-Subject to the terms and conditions of this License, each Contributor hereby
-grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
-irrevocable (except as stated in this section) patent license to make, have
-made, use, offer to sell, sell, import, and otherwise transfer the Work, where
-such license applies only to those patent claims licensable by such Contributor
-that are necessarily infringed by their Contribution(s) alone or by combination
-of their Contribution(s) with the Work to which such Contribution(s) was
-submitted. If You institute patent litigation against any entity (including a
-cross-claim or counterclaim in a lawsuit) alleging that the Work or a
-Contribution incorporated within the Work constitutes direct or contributory
-patent infringement, then any patent licenses granted to You under this License
-for that Work shall terminate as of the date such litigation is filed.
-
-4. Redistribution.
-
-You may reproduce and distribute copies of the Work or Derivative Works thereof
-in any medium, with or without modifications, and in Source or Object form,
-provided that You meet the following conditions:
-
-You must give any other recipients of the Work or Derivative Works a copy of
-this License; and
-You must cause any modified files to carry prominent notices stating that You
-changed the files; and
-You must retain, in the Source form of any Derivative Works that You distribute,
-all copyright, patent, trademark, and attribution notices from the Source form
-of the Work, excluding those notices that do not pertain to any part of the
-Derivative Works; and
-If the Work includes a "NOTICE" text file as part of its distribution, then any
-Derivative Works that You distribute must include a readable copy of the
-attribution notices contained within such NOTICE file, excluding those notices
-that do not pertain to any part of the Derivative Works, in at least one of the
-following places: within a NOTICE text file distributed as part of the
-Derivative Works; within the Source form or documentation, if provided along
-with the Derivative Works; or, within a display generated by the Derivative
-Works, if and wherever such third-party notices normally appear. The contents of
-the NOTICE file are for informational purposes only and do not modify the
-License. You may add Your own attribution notices within Derivative Works that
-You distribute, alongside or as an addendum to the NOTICE text from the Work,
-provided that such additional attribution notices cannot be construed as
-modifying the License.
-You may add Your own copyright statement to Your modifications and may provide
-additional or different license terms and conditions for use, reproduction, or
-distribution of Your modifications, or for any such Derivative Works as a whole,
-provided Your use, reproduction, and distribution of the Work otherwise complies
-with the conditions stated in this License.
-
-5. Submission of Contributions.
-
-Unless You explicitly state otherwise, any Contribution intentionally submitted
-for inclusion in the Work by You to the Licensor shall be under the terms and
-conditions of this License, without any additional terms or conditions.
-Notwithstanding the above, nothing herein shall supersede or modify the terms of
-any separate license agreement you may have executed with Licensor regarding
-such Contributions.
-
-6. Trademarks.
-
-This License does not grant permission to use the trade names, trademarks,
-service marks, or product names of the Licensor, except as required for
-reasonable and customary use in describing the origin of the Work and
-reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty.
-
-Unless required by applicable law or agreed to in writing, Licensor provides the
-Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
-including, without limitation, any warranties or conditions of TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
-solely responsible for determining the appropriateness of using or
-redistributing the Work and assume any risks associated with Your exercise of
-permissions under this License.
-
-8. Limitation of Liability.
-
-In no event and under no legal theory, whether in tort (including negligence),
-contract, or otherwise, unless required by applicable law (such as deliberate
-and grossly negligent acts) or agreed to in writing, shall any Contributor be
-liable to You for damages, including any direct, indirect, special, incidental,
-or consequential damages of any character arising as a result of this License or
-out of the use or inability to use the Work (including but not limited to
-damages for loss of goodwill, work stoppage, computer failure or malfunction, or
-any and all other commercial damages or losses), even if such Contributor has
-been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability.
-
-While redistributing the Work or Derivative Works thereof, You may choose to
-offer, and charge a fee for, acceptance of support, warranty, indemnity, or
-other liability obligations and/or rights consistent with this License. However,
-in accepting such obligations, You may act only on Your own behalf and on Your
-sole responsibility, not on behalf of any other Contributor, and only if You
-agree to indemnify, defend, and hold each Contributor harmless for any liability
-incurred by, or claims asserted against, such Contributor by reason of your
-accepting any such warranty or additional liability.
-
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/License.txt	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,26 @@
+Analog Devices, Inc. (“ADI”)
+Source Code Software License Agreement
+20190709-LWSC-CTSLA
+BEFORE YOU SELECT THE "I ACCEPT" BUTTON AT THE BOTTOM OF THIS WINDOW, CAREFULLY READ THE TERMS AND CONDITIONS SET FORTH BELOW.  BY SELECTING THE “I ACCEPT” BUTTON BELOW, OR DOWNLOADING, REPRODUCING, DISTRIBUTING OR OTHERWISE USING THE SOFTWARE, YOU AGREE TO BE BOUND BY THE TERMS AND CONDITIONS SET FORTH BELOW.  IF YOU DO NOT AGREE TO ALL OF THE TERMS AND CONDITIONS, SELECT THE 'I DO NOT ACCEPT' BUTTON AND YOU MUST NOT DOWNLOAD, INSTALL OR OTHERWISE USE THE SOFTWARE.
+
+DOWNLOADING, REPRODUCING, DISTRIBUTING OR OTHERWISE USING THE SOFTWARE CONSTITUTES ACCEPTANCE OF THIS LICENSE.  THE SOFTWARE MAY NOT BE USED EXCEPT AS EXPRESSLY AUTHORIZED UNDER THIS LICENSE. 
+
+The software is protected by copyright law and international copyright treaties.  
+
+1. License:  Subject to the terms and conditions of this license, the software may be reproduced, modified and distributed in source code and object code form.
+
+2. Conditions: 
+(a) Any distribution of the software must include a complete copy of this license and retain all copyright and other proprietary notices.  The software that is distributed (including modified versions of the software) shall be subject to the terms and conditions of this license.  
+(b) The software may not be combined or merged with other software in any manner that would cause the software to become subject to terms and conditions which differ from those of this license.
+(c) The software is licensed solely and exclusively for use with processors manufactured by or for ADI.
+(d) Licensee shall not use the name or any trademark of ADI (including those of its licensors) or any contributor to endorse or promote products without prior written consent of the owner of the name or trademark.  The term “contributor” means any person or entity that modifies or distributes the software.  
+(e) Modified versions of the Software must be conspicuously marked as such.
+(f) Use of the software may or may not infringe patent rights of one or more patent holders.  This license does not alleviate the obligation to obtain separate licenses from patent holders to use the software.
+(g) All rights not expressly granted hereunder are reserved.  
+(h) This license shall be governed by the laws of Massachusetts, without regard to its conflict of laws rules.  The software shall only be used in compliance with all applicable laws and regulations, including without limitation export control laws.  
+
+3. WARRANTY DISCLAIMER: THE SOFTWARE AND ANY RELATED INFORMATION AND/OR ADVICE IS PROVIDED ON AN “AS IS” BASIS, WITHOUT REPRESENTATIONS, GUARANTEES OR WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, ORAL OR WRITTEN, INCLUDING WITHOUT LIMITATION, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. There is no obligation to provide software support or updates.  The Software is not fault-tolerant and is not intended for use in high risk applications, including without limitation in the operation of nuclear facilities, aircraft navigation or control systems, air traffic control, life support machines, weapons systems, autonomous driving or other safety critical automotive applications, or any other application in which the failure of the software could lead to death, personal injury, or severe physical or environmental damages.  The software is not authorized to be used under such circumstances.
+
+4. LIMITATION OF LIABILITY: TO THE MAXIMUM EXTENT PERMITTED BY LAW ADI (INCLUDING ITS LICENSORS) AND CONTRIBUTORS SHALL NOT BE LIABLE FOR ANY DAMAGES ARISING FROM OR RELATED TO THE SOFTWARE, ITS USE OR ANY RELATED INFORMATION AND/OR SERVICES, INCLUDING BUT NOT LIMITED TO ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE, EXEMPLARY, CONSEQUENTIAL OR ANALOGOUS DAMAGES (INCLUDING WITHOUT LIMITATION ANY DAMAGES RESULTING FROM LOSS OF USE, DATA, REVENUE, PROFITS, OR SAVINGS, COMPUTER DAMAGE OR ANY OTHER CAUSE), UNDER ANY LEGAL THEORY (INCLUDING WITHOUT LIMITATION CONTRACT, WARRANTY, TORT, NEGLIGENCE, STRICT OR PRODUCT LIABILITY), EVEN IF IT HAS BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES.  Some jurisdictions do not permit the exclusion or limitation of liability for consequential, incidental or other damages, and, as such, some portion of the above limitation may not apply.  In such jurisdictions, liability is limited to the greatest extent permitted by law.
+5.  Third Party Software:  The software may be accompanied by or include software made available by one or more third parties (“Third Party Software”).  Each portion of Third Party Software is subject to its own separate software license terms and conditions (“Third Party Licenses”).  The Third Party Licenses for Third Party Software delivered with the software are set forth or identified (by url or otherwise) in (i) Appendix A to this license (if any), (ii) the applicable software header or footer text, (iii) a text file located in the directory of the applicable Third Party Software component and/or (iv) such other location customarily used for licensing terms. The use of each portion of Third Party Software is subject to the Third Party Licenses, and you agree that your use of any Third Party Software is bound by the applicable Third Party License.  You agree to review and comply with all applicable Third Party Licenses prior to any use or distribution of any Third Party Software.  Third Party Software is provided on an “as is” basis without any representation, warranty or liability of any kind.  ADI (including its licensors) and contributors shall have no liability or responsibility for the operation or performance of the Third Party Software and shall not be liable for any damages, costs, or expenses, direct or indirect, arising out of the performance or failure to perform of the Third Party Software.  ADI (including its licensors) and contributors shall be entitled to the benefit of any and all limitations of liability and disclaimers of warranties contained in the Third Party Licenses. For the avoidance of doubt, this license does not alter, limit or expand the terms and conditions of, or rights granted to you pursuant to, Third Party Licenses.  
+
--- a/README.txt	Wed Sep 29 11:39:40 2021 +0000
+++ b/README.txt	Thu Sep 30 11:58:20 2021 +0100
@@ -1,45 +1,38 @@
 Evaluation Boards/Products Supported
 ------------------------------------ 
-EVAL-AD1234 (AD1234)
-EVAL-AD1256 (AD1256)
-<< add more here >>
- 
+-Products supported: AD4695, AD4696
+-EVAL-AD4696FMCZ
+
+
 Overview
 --------
-These code files provide drivers to interface with AD1234 and communicate with 
-EVAL-AD1234 board. This code was developed and tested on SDP-K1 controller board 
-https://os.mbed.com/platforms/SDP_K1/. 
- 
-Product details: https://www.analog.com/en/products/ad1234.html
-Eval board details: https://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/EVAL-AD1234.html
- 
- 
+This is an IIO ecosystem based firmware application to evalute the AD4696 family ADCs.
+The ADI developed ARM Mbed SDP-K1 controlled board acts as a target device, where firmware application is running.
+The ARM GCC/ARMC compiler is used for firmware development on ARM Mbed platform.
+The EVAL-AD4696FMCZ board is interfaced with SDP-K1 (or any Arduino compatible board) controller board using on-board Arduino Headers.
+
+
 Hardware Setup
 --------------
-Required: SDP-K1, EVAL-AD1234, USB cable, 12 V power supply, 60 MHz external 
-clock supply.
-Plug in the EVAL-AD124 board on SDP-K1 board (or any other Mbed enabled 
-controller board) using the SDP connector and screws.
-Connect SDP-K1 board to the PC using the USB cable.
- 
- 
+Refer "Hardware Connections" section from below wiki page link:
+https://wiki.analog.com/resources/tools-software/product-support-software/ad4696_mbed_iio_application
+
+
 How to Get Started
 ------------------
 Open Mbed online compiler. https://ide.mbed.com/compiler
-Import Code into compiler from here: https://os.mbed.com/teams/AnalogDevices/code/EVAL-AD1234/
-instructions on how to import code are here: https://os.mbed.com/docs/mbed-os/v5.12/tools/importing-code.html
-Compile code. Drag and drop binary into SDP-K1 controller board. Find detailed instructions 
-here: https://os.mbed.com/docs/mbed-os/v5.12/tools/getting-your-program-on-your-board.html
-Open Tera Term (or alternative), select 9600 baud rate, and the applicable COM port to see the 
-list of options.
- 
-A detailed user guide on how to use SDP-K1 board on Mbed platform is available 
-here: https://wiki.analog.com/resources/tools-software/mbed
- 
- 
+Import Code into compiler. Instructions on how to import code are here: https://os.mbed.com/docs/mbed-os/v6.8/quick-start/build-with-the-online-compiler.html
+Compile code to generate binary file and then drag and drop binary into SDP-K1 controller board. Detailed instructions are here:
+https://os.mbed.com/docs/mbed-os/v6.8/build-tools/getting-your-program-on-your-board.html
+
+Refere project wiki page to find detailed guide on how to use firmware:
+https://wiki.analog.com/resources/tools-software/product-support-software/ad4696_mbed_iio_application
+
+
 Notes
 -----
-If using Win 7, install serial drivers for Mbed. https://os.mbed.com/docs/mbed-os/v5.12/tutorials/windows-serial-driver.html
+Refere this page for latest documentation on Mbed-OS: https://os.mbed.com/docs/mbed-os/v6.8/introduction/index.html
 A detailed user guide on SDP-K1 controller board is available here https://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/SDP-K1.html.
- 
-            
\ No newline at end of file
+
+
+Copyright (c) 2021 Analog Devices, Inc.  All rights reserved.
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/.mbedignore	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,21 @@
+no-OS/ad5758-sdz/
+no-OS/AD6673-EBZ/
+no-OS/AD9250-EBZ/
+no-OS/adum7701_fmc/
+no-OS/ci/
+no-OS/common_drivers/
+no-OS/device_drivers/
+no-OS/doc/
+no-OS/drivers/
+no-OS/iio/
+no-OS/legacy/
+no-OS/libraries/fatfs/
+no-OS/libraries/mbedtls/
+no-OS/libraries/mqtt/
+no-OS/network/
+no-OS/projects/
+no-OS/scripts/
+no-OS/tools/
+no-OS/v4l2_config/
+libtinyiiod/ci/
+libtinyiiod/example.c
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ad4696_data_capture.c	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,428 @@
+/***************************************************************************//**
+ *   @file    ad4696_data_capture.c
+ *   @brief   Data capture interface for AD4696 IIO application
+ *   @details This module handles the AD4696 data capturing for IIO client
+********************************************************************************
+ * Copyright (c) 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.
+*******************************************************************************/
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "app_config.h"
+#include "iio_ad4696.h"
+#include "ad4696_data_capture.h"
+#include "adc_data_capture.h"
+#include "error.h"
+#include "gpio.h"
+#include "util.h"
+#include "pwm.h"
+#include "ad4696_support.h"
+
+/******************************************************************************/
+/********************** Macros and Constants Definition ***********************/
+/******************************************************************************/
+/* Note: Timeout is dependent upon MCU clock frequency and tested for SDP-K1 
+ * Mbed platform 
+ * */
+#define BSY_CHECK_TIMEOUT 1000
+
+/******************************************************************************/
+/********************** Variables and User Defined Data Types *****************/
+/******************************************************************************/
+/* Flag to mark the start of continuous read event */
+static volatile bool continuous_data_read = false;
+/* Previously active channels */
+static uint32_t ad4696_prev_active_chns = 0;
+
+/******************************************************************************/
+/************************ Functions Declarations ******************************/
+/******************************************************************************/
+
+/* Save the previous active channels value */
+static int32_t ad4696_save_prev_active_chns(void);
+/* Restore (enable) the previous active channels */
+static int32_t ad4696_restore_prev_active_chns(void);
+/* Enable ADC current (user input) channel */
+static int32_t ad4696_enable_curr_chn(uint8_t chn);
+/* Enable ADC channels according to channel mask*/
+static int32_t ad4696_enable_channel_mask(uint32_t chn_msk);
+/* Disable ADC current (user input) channel */
+static int32_t ad4696_disable_curr_chn(uint8_t chn);
+/* Disable all ADC channels */
+static int32_t ad4696_disable_all_chns(void);
+/* Enable conversion for single sample read */
+static int32_t ad4696_single_sample_read_start_ops(uint8_t input_chn);
+/* Enable conversion for continuous sample read */
+static int32_t ad4696_enable_continuous_read_conversion(uint32_t ch_mask);
+/* Disable conversion */
+static int32_t ad4696_continuous_sample_read_stop_ops(void);
+/* Wait for conversion to finish on enabled channels and read conversion data */
+static int32_t ad4696_perform_conv_and_read_sample(uint32_t *adc_data);
+/* Read ADC raw sample/data */
+static int32_t ad4696_read_converted_sample(uint32_t *adc_data);
+/* Monitor end of conversion event */
+static int32_t ad4696_end_of_conversion_check(void);
+
+/* Define the variable for data_capture_ops structure */
+struct data_capture_ops data_capture_ops = {
+	/* Point ad7134 data capture functions to generic ADC data capture functions */
+	.single_sample_read_start_ops = ad4696_single_sample_read_start_ops,
+	.perform_conv_and_read_sample = ad4696_perform_conv_and_read_sample,
+	.single_sample_read_stop_ops = ad4696_continuous_sample_read_stop_ops,
+	.continuous_sample_read_start_ops = ad4696_enable_continuous_read_conversion,
+	.read_converted_sample = ad4696_read_converted_sample,
+	.continuous_sample_read_stop_ops = ad4696_continuous_sample_read_stop_ops,
+	.trigger_next_conversion = NULL
+};		
+
+/******************************************************************************/
+/************************ Functions Definitions *******************************/
+/******************************************************************************/
+
+/*!
+ * @brief	Save the previous active channels 
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t ad4696_save_prev_active_chns(void)
+{
+	uint8_t data;
+	/* Read the upper byte of the standard sequencer configuration register*/
+	if (ad469x_spi_reg_read(p_ad4696_dev, AD469x_REG_SEQ_UB, &data) != SUCCESS) {
+		return FAILURE;
+	}
+	
+	/* The upper byte channel configuration is saved to the variable and is
+	 * shifted by 8 bits to save the lower byte register configuration */
+	ad4696_prev_active_chns = data;
+	ad4696_prev_active_chns <<= 8; 
+	
+	/* Reads the lower byte of the standard sequencer configuration register*/
+	if (ad469x_spi_reg_read(p_ad4696_dev, AD469x_REG_SEQ_LB, &data) != SUCCESS) { 
+		return FAILURE;
+	}
+	ad4696_prev_active_chns |= data; 
+
+	return SUCCESS;
+}
+
+/*!
+ * @brief	Restore (re-enable) the previous active channels
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t ad4696_restore_prev_active_chns(void)
+{	
+	if (ad469x_exit_conversion_mode(p_ad4696_dev) != SUCCESS)
+		return FAILURE;
+	
+	/* Configure the lower byte of the standard sequencer configuration register*/
+	if (ad469x_spi_reg_write(p_ad4696_dev, 
+		AD469x_REG_SEQ_LB, 
+		AD469x_SEQ_LB_CONFIG(ad4696_prev_active_chns)) != SUCCESS) {
+		return FAILURE;
+	}
+	
+	/* Configure the upper byte of the standard sequencer configuration register*/
+	if (ad469x_spi_reg_write(p_ad4696_dev,
+		AD469x_REG_SEQ_UB,
+		AD469x_SEQ_UB_CONFIG(ad4696_prev_active_chns)) != SUCCESS) {
+		return FAILURE;
+	}
+	
+	return SUCCESS;
+}
+
+/*!
+ * @brief	Disable all active channels
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t ad4696_disable_all_chns(void)
+{	
+	/* Reset the lower byte of the standard sequencer configuration register*/
+	if (ad469x_spi_reg_write(p_ad4696_dev,
+		AD469x_REG_SEQ_LB,
+		AD469x_SEQ_CHANNELS_RESET) != SUCCESS) {
+		return FAILURE;
+	}
+	
+	/* Reset the upper byte of the standard sequencer configuration register*/
+	if (ad469x_spi_reg_write(p_ad4696_dev, 
+		AD469x_REG_SEQ_UB,
+		AD469x_SEQ_CHANNELS_RESET) != SUCCESS) {
+		return FAILURE;
+	}
+	
+	return SUCCESS;
+}
+
+/*!
+ * @brief	Enable input channel
+ * @param	chn[in] - Channel to enable
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t ad4696_enable_curr_chn(uint8_t chn)
+{
+	/* If channel number is less than 8, then write to 
+	 * lower byte configuration register or else write 
+	 * to upper byte configuration register 
+	 * */
+	if (chn < (NO_OF_CHANNELS / 2)) {
+		if (ad469x_spi_write_mask(p_ad4696_dev, 
+			AD469x_REG_SEQ_LB,
+			AD469x_SEQ_CHANNELS_RESET,
+			AD469x_SINGLE_CHANNEL_EN(chn))  != SUCCESS) {
+			return FAILURE; 
+		}
+	}	
+	else {
+		if (ad469x_spi_write_mask(p_ad4696_dev,
+			AD469x_REG_SEQ_UB, 
+			AD469x_SEQ_CHANNELS_RESET,
+			AD469x_SINGLE_CHANNEL_EN(chn - 8)) != SUCCESS) {
+			return FAILURE;
+		}
+	} 
+	
+	return SUCCESS;
+}
+
+/*!
+ * @brief	Enable input channels according to the mask
+ * @param	chn_msk[in] - Mask containing channels to be enabled
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t ad4696_enable_channel_mask(uint32_t chn_msk)
+{
+	/* Write the lower byte of the channel mask to the lower byte 
+	 * of the standard sequencer configuration register 
+	 * */
+	if (ad469x_spi_reg_write(p_ad4696_dev, 
+		AD469x_REG_SEQ_LB,
+		AD469x_SEQ_LB_CONFIG(chn_msk))  != SUCCESS) {
+		return FAILURE; 
+	}
+	
+	/* Write the upper byte of the channel mask to the upper byte 
+	 * of the standard sequencer configuration register
+	 * */
+	if (ad469x_spi_reg_write(p_ad4696_dev,
+		AD469x_REG_SEQ_UB, 
+		AD469x_SEQ_UB_CONFIG(chn_msk)) != SUCCESS) {
+		return FAILURE;
+	}
+	
+	return SUCCESS;
+}
+
+/*!
+ * @brief	Disable input channel
+ * @param	chn[in] - Channel to disable
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t ad4696_disable_curr_chn(uint8_t chn)
+{
+	/* If channel number is less than 8, then write 
+	 * to lower byte configuration register or else 
+	 * write to upper byte configuration register 
+	 * */
+	if (chn < (NO_OF_CHANNELS/2)) {
+		if (ad469x_spi_write_mask(p_ad4696_dev,
+			AD469x_REG_SEQ_LB, 
+			AD469x_SINGLE_CHANNEL_EN(chn),
+			AD469x_SEQ_CHANNEL_DI) != SUCCESS) {
+			return FAILURE;
+		}
+	}
+	else {
+		if (ad469x_spi_write_mask(p_ad4696_dev,
+			AD469x_REG_SEQ_UB,
+			AD469x_SINGLE_CHANNEL_EN(chn - 8),
+			AD469x_SEQ_CHANNEL_DI) != SUCCESS) {
+			return FAILURE;
+		}
+	} 
+
+	return SUCCESS;
+}
+
+/*!
+ * @brief	Enable conversion for single data read
+ * @param	input_chn[in] - Channel to be enabled
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t ad4696_single_sample_read_start_ops(uint8_t input_chn)
+{
+	do {
+		/* Save previously active channels */
+		if (ad4696_save_prev_active_chns() != SUCCESS) {
+			break;
+		}
+		
+		/* Disable all channels */
+		if (ad4696_disable_all_chns() != SUCCESS) {
+			break;
+		}
+		
+		/* Enable user input channel */
+		if (ad4696_enable_curr_chn(input_chn) != SUCCESS) {
+			break;
+		}
+		
+		/* Enter into conversion mode */
+		if (ad469x_enter_conversion_mode(p_ad4696_dev) != SUCCESS) {
+			break;
+		}
+		
+		return SUCCESS;
+	} while (0);
+	
+	return FAILURE;
+}
+
+/*!
+ * @brief	Enable conversion for continuous (sequencing) data read
+ * @param	ch_mask[in] - Mask containing channels to be enabled
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t ad4696_enable_continuous_read_conversion(uint32_t ch_mask)
+{
+	do {
+		/* Save previously active channels */
+		if (ad4696_save_prev_active_chns() != SUCCESS) {
+			break;
+		}
+		
+		/* Disable all channels */
+		if (ad4696_disable_all_chns() != SUCCESS) {
+			break;
+		}
+		
+		/* Enable user input channels */
+		if (ad4696_enable_channel_mask(ch_mask) != SUCCESS) {
+			break;
+		}
+
+		/* Start Generating PWM signal */
+		if (pwm_enable(pwm_desc) != SUCCESS) {
+			break;
+		}
+		
+		continuous_data_read = true;
+		/* Enter into conversion mode */
+		if (ad469x_enter_conversion_mode(p_ad4696_dev) != SUCCESS) {
+			break;
+		}
+
+		return SUCCESS;
+	} while (0);	
+	
+	return FAILURE;
+}
+
+/*!
+ * @brief	Disable ADC conversion
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t ad4696_continuous_sample_read_stop_ops(void)
+{	
+	if (continuous_data_read) {
+		/* Stop Generating PWM signal */
+		if (pwm_disable(pwm_desc) != SUCCESS) {
+			return FAILURE;
+		}
+	}
+	
+	/* Enter into register mode or exit from conversion mode */
+	if (ad469x_exit_conversion_mode(p_ad4696_dev) != SUCCESS) {
+		return FAILURE;
+	}
+	
+	/* Enable back channels which were disabled prior to conversion start*/
+	if (ad4696_restore_prev_active_chns() != SUCCESS) {
+		return FAILURE;
+	}
+	
+	continuous_data_read = false;
+	return SUCCESS;
+}
+
+/*!
+ * @brief	Read ADC raw data for recently sampled channel
+ * @param	adc_raw[out] - Pointer to adc data read variable
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ * @note	This function is intended to call from the conversion end trigger
+ *			event. Therefore, this function should just read raw ADC data
+ *			without further monitoring conversion end event
+ */
+static int32_t ad4696_read_converted_sample(uint32_t *adc_raw)
+{
+	/* Null Check */
+	if (!adc_raw) {
+		return FAILURE;
+	}
+	
+	/* Read the converted ADC raw data and return the transaction result*/
+	return ad469x_read_data(p_ad4696_dev, 0, adc_raw, 1);
+}
+
+/*!
+ * @brief	Read ADC single sample data
+ * @param	read_adc_data[out] - Pointer to adc data read variable
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ * @details	This function performs the sampling on previously active channels
+ *			and then reads conversion result
+ */
+static int32_t ad4696_perform_conv_and_read_sample(uint32_t *read_adc_data)
+{
+	uint32_t adc_raw = 0;
+
+	/* Read the converted ADC raw data */
+	if (ad469x_read_data(p_ad4696_dev, 1, &adc_raw, 1) != SUCCESS) {
+		return FAILURE;
+	}
+	
+	*read_adc_data = adc_raw;
+	return SUCCESS;
+}
+
+/*!
+ * @brief	Check for the end of conversion event
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ * @details	This function monitors the state line for BSY pin 
+ *			until timeout is reached
+ */
+static int32_t ad4696_end_of_conversion_check(void)
+{
+	uint16_t timeout = (uint16_t)BSY_CHECK_TIMEOUT; /* time out counter */
+	uint8_t busy = GPIO_HIGH; /* GPIO initial state */
+	
+	/* Check for BSY to go low */
+	while (busy == GPIO_HIGH) {
+		gpio_get_value(((struct ad469x_dev *)p_ad4696_dev)->gpio_busy, &busy);
+		timeout--;
+		if (!timeout) {
+			return FAILURE;
+		}
+	}
+		
+	timeout = (uint16_t)BSY_CHECK_TIMEOUT;
+	/* Check for BSY pin to go high */
+	while (busy == GPIO_LOW) {
+		gpio_get_value(((struct ad469x_dev *)p_ad4696_dev)->gpio_busy, &busy);
+		timeout--;
+		if (!timeout) {
+			return FAILURE;
+		}
+	}
+	
+	return SUCCESS;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ad4696_data_capture.h	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,37 @@
+/***************************************************************************//**
+ *   @file   ad4696_data_capture.h
+ *   @brief  Header for AD4696 data capture interfaces
+********************************************************************************
+ * Copyright (c) 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.
+*******************************************************************************/
+
+#ifndef _AD4696_DATA_CAPTURE_H_
+#define _AD4696_DATA_CAPTURE_H_
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include "app_config.h"
+#include "ad469x.h"
+#include "adc_data_capture.h"
+
+/******************************************************************************/
+/********************** Macros and Constants Definition ***********************/
+/******************************************************************************/
+
+/******************************************************************************/
+/********************** Variables and User Defined Data Types *****************/
+/******************************************************************************/
+
+/******************************************************************************/
+/************************ Public Declarations *********************************/
+/******************************************************************************/
+
+#endif /* _AD4696_DATA_CAPTURE_H_ */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ad4696_support.c	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,94 @@
+/*************************************************************************//**
+ *   @file   ad4696_support.c
+ *   @brief  AD469x device No-OS driver supports
+******************************************************************************
+* Copyright (c) 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.
+*****************************************************************************/
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <stdint.h>
+
+#include "app_config.h"
+#include "ad4696_support.h"
+#include "error.h"
+
+/******************************************************************************/
+/********************** Macros and Constants Definition ***********************/
+/******************************************************************************/
+
+/******************************************************************************/
+/********************** Variables and User Defined Data Types *****************/
+/******************************************************************************/
+
+/******************************************************************************/
+/************************ Functions Definitions *******************************/
+/******************************************************************************/
+/*!
+ * @brief	Enter Manual Trigger mode
+ * @param	device[in] - device instance
+ * @return	SUCCESS in case of success, negative error code otherwise.
+ */
+int32_t ad4696_enable_manual_trigger_mode(struct ad469x_dev *device)
+{
+	do 
+	{
+		if (ad469x_spi_reg_write(device,
+			AD469x_REG_SETUP, 
+			AD469x_REG_SETUP_RESET) != SUCCESS) {
+			break;
+		}
+	
+		if (ad469x_spi_reg_write(device,
+			AD469x_REG_SEQ_CTRL, 
+			AD469x_REG_SEQ_CTRL_RESET) != SUCCESS) {
+			break;
+		}
+
+		return SUCCESS;
+	} while (0);
+	
+	return FAILURE;
+}
+
+/*!
+ * @brief	Select between polarity modes
+ * @param	device[in] - device instance
+ * @return	SUCCESS in case of success, negative error code otherwise.
+ */
+int32_t ad4696_polarity_mode_select(struct ad469x_dev *device)
+{
+	uint8_t data = 0;
+
+	for (uint8_t i = 0; i < AD469x_CHANNEL_NO;i++)
+	{
+		if (ad469x_spi_reg_read(device,
+			AD469x_REG_CONFIG_IN(i), 
+			&data) != SUCCESS) {
+			return FAILURE;
+		}
+		
+#if defined(PSEUDO_BIPOLAR_MODE)		 
+		data |= (AD469x_REG_CONFIG_IN_PAIR(AD469x_PSEUDO_BIPOLAR_MODE)
+				| AD469x_REG_CONFIG_IN_MODE(AD469x_INx_COM));
+#else
+		data |= (AD469x_REG_CONFIG_IN_PAIR(AD469x_UNIPOLAR_MODE)
+				| AD469x_REG_CONFIG_IN_MODE(AD469x_INx_REF_GND));
+#endif
+		
+		if (ad469x_spi_reg_write(device,
+			AD469x_REG_CONFIG_IN(i), 
+			data) != SUCCESS) {
+			return FAILURE;
+		}
+	}
+	return SUCCESS;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ad4696_support.h	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,95 @@
+/***************************************************************************//**
+ *   @file   ad4696_support.h
+ *   @brief  Header for AD469x No-OS driver supports
+********************************************************************************
+ * Copyright (c) 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.
+*******************************************************************************/
+
+#ifndef AD4696_SUPPORT_H_
+#define AD4696_SUPPORT_H_
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include "ad469x.h"
+#include "util.h"
+
+/******************************************************************************/
+/********************** Macros and Constants Definition ***********************/
+/******************************************************************************/
+
+/* Number of AD469x registers */
+#define NUM_OF_REGISTERS	0x17F
+
+/* Default channel range for AD4696 devices */
+#define DEFAULT_VREF                (5.0)
+
+/* AD469x_REG_TEMPERATURE */
+#define AD469x_TEMPERATURE_MSK		GENMASK(0,0)
+
+/* AD469x Sequencer Lower Byte Configuration */
+#define AD469x_SEQ_LB_CONFIG(x)    ( x & GENMASK(7,0))		
+
+/* AD469x Sequencer Upper Byte Configuration */
+#define AD469x_SEQ_UB_CONFIG(x)    ( x >> 8)	
+
+/* AD469x Sequencer Lower Byte Register */
+#define AD469x_REG_SEQ_LB          AD469x_REG_STD_SEQ_CONFIG
+
+/* AD469x Sequencer Upper Byte Register */
+#define AD469x_REG_SEQ_UB          (AD469x_REG_STD_SEQ_CONFIG + 0x01)
+
+/* AD469x Sequencer Lower Byte Configuration */
+#define AD469x_SINGLE_CHANNEL_EN(x)    AD469x_CHANNEL(x)	
+
+/* AD469x Enable Autocycle Mode*/
+#define AD469x_SEQ_CHANNELS_RESET      0x00
+
+/* AD469x Sequencer disable all channels */
+#define AD469x_EN_AUTOCYLE_MODE	       0x01
+
+/* AD469x Manual Trigger Configurations */
+#define AD469x_REG_SETUP_RESET         0x10
+#define AD469x_REG_SEQ_CTRL_RESET      0x80
+
+/* AD469x Sequencer disable all channels */
+#define AD469x_SEQ_CHANNEL_EN          1
+#define AD469x_SEQ_CHANNEL_DI          0
+
+/******************************************************************************/
+/********************** Variables and User Defined Data Types *****************/
+/******************************************************************************/
+/**
+ * @enum ad469x_polarity_select
+ * @brief Channel polarity modes
+ */
+enum ad469x_polarity_select {
+	AD469x_UNIPOLAR_MODE,
+	AD469x_PSEUDO_BIPOLAR_MODE
+};
+
+/**
+ * @enum ad469x_pin_pairing_select
+ * @brief Channel pin pairing options
+ */
+enum ad469x_pin_pairing_select {
+	AD469x_INx_REF_GND,
+	AD469x_INx_COM,
+	AD469x_INx_EVEN_ODD
+};
+
+/******************************************************************************/
+/************************ Public Declarations *********************************/
+/******************************************************************************/
+
+int32_t ad4696_enable_manual_trigger_mode(struct ad469x_dev *device);
+int32_t ad4696_polarity_mode_select(struct ad469x_dev *device);
+
+#endif /* AD4696_SUPPORT_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ad4696_user_config.c	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,68 @@
+/*************************************************************************//**
+ *   @file   ad4696_user_config.c
+ *   @brief  User configuration file for AD4696 device
+******************************************************************************
+* Copyright (c) 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.
+*****************************************************************************/
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <stdint.h>
+#include "app_config.h"
+#include "ad4696_user_config.h"
+#include "ad4696_support.h"
+#include "gpio.h"
+#include "spi_extra.h"
+#include "gpio_extra.h"
+
+/******************************************************************************/
+/********************** Macros and Constants Definition ***********************/
+/******************************************************************************/
+
+#define		USER_CONFIG_RANGE	(DEFAULT_CHN_RANGE * 1000)
+
+/******************************************************************************/
+/********************** Variables and User Defined Data Types *****************/
+/******************************************************************************/
+
+struct gpio_init_param gpio_init_reset = {
+	.number = RESET_PIN,
+	.extra = NULL
+};
+
+struct gpio_init_param gpio_init_convst = {
+	.number = CONVST_PIN,
+	.extra = NULL
+};
+
+struct gpio_init_param gpio_init_busy = {
+	.number = BUSY_PIN,
+	.extra = &bsy_gpio_extra_init_params
+};
+
+struct spi_init_param spi_init_params = {
+	.max_speed_hz = 22500000,    	// Max SPI Speed
+	.chip_select = SPI_CSB,    		// Chip Select
+	.mode = SPI_MODE_3,    			// CPOL = 1, CPHA = 1
+	.extra = &spi_extra_init_params	// SPI extra configurations
+};
+
+/* Initialize the AD4696 device structure */
+struct ad469x_init_param ad4696_init_str = {
+	// Define SPI init parameters structure
+	.spi_init = &spi_init_params,
+
+	// Define GPIOs init parameter structure
+	.gpio_resetn = &gpio_init_reset,
+	.gpio_convst = &gpio_init_convst,
+	.gpio_busy = &gpio_init_busy,
+	.dev_id = ACTIVE_DEVICE
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ad4696_user_config.h	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,33 @@
+/*************************************************************************//**
+ *   @file   ad4696_user_config.h
+ *   @brief  Header for AD4696 user configuration file
+******************************************************************************
+* Copyright (c) 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.
+*****************************************************************************/
+
+#ifndef AD4696_USER_CONFIG_H
+#define AD4696_USER_CONFIG_H
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <stdint.h>
+#include "ad469x.h"
+
+/******************************************************************************/
+/********************** Macros and Constants Definition ***********************/
+/******************************************************************************/
+
+/******************************************************************************/
+/********************** Variables and User Defined Data Types *****************/
+/******************************************************************************/
+extern struct ad469x_init_param ad4696_init_str;
+
+#endif /* end of AD4696_USER_CONFIG_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ad469x.c	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,937 @@
+/***************************************************************************//**
+ *   @file   ad469x.c
+ *   @brief  Implementation of ad469x Driver.
+ *   @author Cristian Pop (cristian.pop@analog.com)
+********************************************************************************
+ * Copyright 2021(c) Analog Devices, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  - Neither the name of Analog Devices, Inc. nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *  - The use of this software may or may not infringe the patent rights
+ *    of one or more patent holders.  This license does not release you
+ *    from the requirement that you obtain separate licenses from these
+ *    patent holders to use this software.
+ *  - Use of the software either in source or binary form, must be run
+ *    on or directly connected to an Analog Devices Inc. component.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "ad469x.h"
+#include "delay.h"
+#include "error.h"
+#include "util.h"
+#include "gpio.h"
+
+#define AD469x_TEST_DATA 0xEA
+/******************************************************************************/
+/********************** Macros and Constants Definitions **********************/
+/******************************************************************************/
+
+/**
+ * @brief Device resolution
+ */
+const uint8_t ad469x_device_resol[] = {
+	[AD469x_OSR_1] = 16,
+	[AD469x_OSR_4] = 17,
+	[AD469x_OSR_16] = 18,
+	[AD469x_OSR_64] = 19
+};
+
+/******************************************************************************/
+/************************** Functions Implementation **************************/
+/******************************************************************************/
+
+/**
+ * Read from device.
+ * @param dev - The device structure.
+ * @param reg_addr - The register address.
+ * @param reg_data - The register data.
+ * @return SUCCESS in case of success, negative error code otherwise.
+ */
+int32_t ad469x_spi_reg_read(struct ad469x_dev *dev,
+	uint16_t reg_addr,
+	uint8_t *reg_data)
+{
+	int32_t ret;
+	uint8_t buf[3];
+
+#if defined (ENABLE_SPI_ENGINE)
+	ret = spi_engine_set_transfer_width(dev->spi_desc, dev->reg_data_width);
+	if (ret != SUCCESS)
+		return ret;
+
+	spi_engine_set_speed(dev->spi_desc, dev->reg_access_speed);
+#endif
+
+	buf[0] = (1 << 7) | ((reg_addr >> 8) & 0x7F);
+	buf[1] = 0xFF & reg_addr;
+	buf[2] = 0xFF;
+
+	ret = spi_write_and_read(dev->spi_desc, buf, 3);
+	*reg_data = buf[2];
+
+#if defined (ENABLE_SPI_ENGINE)  
+	ret = spi_engine_set_transfer_width(dev->spi_desc, dev->capture_data_width);
+	if (ret != SUCCESS)
+		return ret;
+
+	spi_engine_set_speed(dev->spi_desc, dev->spi_desc->max_speed_hz);
+#endif
+
+	return ret;
+}
+
+/**
+ * Write to device.
+ * @param dev - The device structure.
+ * @param reg_addr - The register address.
+ * @param reg_data - The register data.
+ * @@eturn SUCCESS in case of success, negative error code otherwise.
+ */
+int32_t ad469x_spi_reg_write(struct ad469x_dev *dev,
+	uint16_t reg_addr,
+	uint8_t reg_data)
+{
+	int32_t ret;
+	uint8_t buf[3];
+
+#if defined (ENABLE_SPI_ENGINE) 
+	ret = spi_engine_set_transfer_width(dev->spi_desc, dev->reg_data_width);
+	if (ret != SUCCESS)
+		return ret;
+
+	spi_engine_set_speed(dev->spi_desc, dev->reg_access_speed);
+#endif
+
+	buf[0] = ((reg_addr >> 8) & 0x7F);
+	buf[1] = 0xFF & reg_addr;
+	buf[2] = reg_data;
+
+	ret = spi_write_and_read(dev->spi_desc, buf, 3);
+
+#if defined (ENABLE_SPI_ENGINE)
+	ret = spi_engine_set_transfer_width(dev->spi_desc,
+		dev->capture_data_width);
+	if (ret != SUCCESS)
+		return ret;
+
+	spi_engine_set_speed(dev->spi_desc, dev->spi_desc->max_speed_hz);
+#endif
+
+	return ret;
+}
+
+/**
+ * SPI read from device using a mask.
+ * @param dev - The device structure.
+ * @param reg_addr - The register address.
+ * @param mask - The mask.
+ * @param data - The register data.
+ * @return SUCCESS in case of success, negative error code otherwise.
+ */
+int32_t ad469x_spi_read_mask(struct ad469x_dev *dev,
+	uint16_t reg_addr,
+	uint8_t mask,
+	uint8_t *data)
+{
+	uint8_t reg_data[3];
+	int32_t ret;
+
+	ret = ad469x_spi_reg_read(dev, reg_addr, reg_data);
+	if (ret != SUCCESS)
+		return ret;
+
+	*data = (reg_data[0] & mask);
+
+	return ret;
+}
+
+/**
+ * SPI write to device using a mask.
+ * @param dev - The device structure.
+ * @param reg_addr - The register address.
+ * @param mask - The mask.
+ * @param data - The register data.
+ * @return SUCCESS in case of success, negative error code otherwise.
+ */
+int32_t ad469x_spi_write_mask(struct ad469x_dev *dev,
+	uint16_t reg_addr,
+	uint8_t mask,
+	uint8_t data)
+{
+	uint8_t reg_data;
+	int32_t ret;
+
+	ret = ad469x_spi_reg_read(dev, reg_addr, &reg_data);
+	if (ret != SUCCESS)
+		return ret;
+
+	reg_data &= ~mask;
+	reg_data |= data;
+
+	return ad469x_spi_reg_write(dev, reg_addr, reg_data);
+}
+
+/**
+ * @brief Configure register access mode
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] access - Access mode
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_set_reg_access_mode(struct ad469x_dev *dev,
+	enum ad469x_reg_access access)
+{
+	return ad469x_spi_write_mask(dev,
+		AD469x_REG_IF_CONFIG_C,
+		AD469x_REG_IF_CONFIG_C_MB_STRICT_MASK,
+		AD469x_REG_IF_CONFIG_C_MB_STRICT(access));
+}
+
+/**
+ * @brief Initialize GPIO driver handlers for the GPIOs in the system.
+ *        ad469x_init() helper function.
+ * @param [out] dev - ad469x_dev device handler.
+ * @param [in] init_param - Pointer to the initialization structure.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+static int32_t ad469x_init_gpio(struct ad469x_dev *dev,
+	struct ad469x_init_param *init_param)
+{
+	int32_t ret;
+
+	do 
+	{
+		ret = gpio_get_optional(&dev->gpio_resetn, init_param->gpio_resetn);
+		if (ret != SUCCESS)
+			break;
+
+		/** Reset to configure pins */
+		if (init_param->gpio_resetn) {
+			ret = gpio_direction_output(dev->gpio_resetn, GPIO_LOW);
+			if (ret != SUCCESS)
+				break;
+
+			mdelay(100);
+			ret = gpio_set_value(dev->gpio_resetn, GPIO_HIGH);
+			if (ret != SUCCESS)
+				break;
+
+			mdelay(100);
+		}
+	
+		/** Initialize the BUSY GPIO descriptor **/
+		ret = gpio_get_optional(&dev->gpio_busy, init_param->gpio_busy);
+		if (ret != SUCCESS)
+			break;
+		
+		if (init_param->gpio_busy) {
+			if (gpio_direction_input(dev->gpio_busy) != SUCCESS)
+				break;
+		}
+		
+		return SUCCESS;
+	} while (0);
+
+	return FAILURE;
+}
+
+/**
+ * @brief Configure over sampling ratio in advanced sequencer mode
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] ch - Channel to configure.
+ * @param [in] ratio - OSR ratio.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_adv_seq_osr(struct ad469x_dev *dev,
+	uint16_t ch,
+	enum ad469x_osr_ratios ratio)
+{
+	int32_t ret;
+
+	if (dev->ch_sequence == AD469x_single_cycle ||
+	    dev->ch_sequence == AD469x_two_cycle)
+		return FAILURE;
+
+	if (ch >= AD469x_CHANNEL_NO)
+		return FAILURE;
+
+	ret = ad469x_spi_write_mask(dev,
+		AD469x_REG_CONFIG_IN(ch),
+		AD469x_REG_CONFIG_IN_OSR_MASK,
+		AD469x_REG_CONFIG_IN_OSR(ratio));
+	if (ret != SUCCESS)
+		return ret;
+
+	dev->adv_seq_osr_resol[ch] = ad469x_device_resol[ratio];
+	/* Set storage to maximum data width */
+	dev->capture_data_width = ad469x_device_resol[AD469x_OSR_64];
+
+	return SUCCESS;
+}
+
+/**
+ * @brief Configure over sampling ratio to 1 in single and two cycle modes.
+ * @param [in] dev - ad469x_dev device handler.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+static int32_t ad469x_seq_osr_clear(struct ad469x_dev *dev)
+{
+	int32_t ret;
+	uint8_t i = 0;
+
+	for (i = 0; i < AD469x_CHANNEL_NO; i++) {
+		ret = ad469x_spi_write_mask(dev,
+			AD469x_REG_CONFIG_IN(i),
+			AD469x_REG_CONFIG_IN_OSR_MASK,
+			AD469x_REG_CONFIG_IN_OSR(AD469x_OSR_1));
+		if (ret != SUCCESS)
+			return ret;
+		dev->adv_seq_osr_resol[i] = ad469x_device_resol[AD469x_OSR_1];
+	}
+	/* Set storage to minimum data width */
+	dev->capture_data_width = ad469x_device_resol[AD469x_OSR_1];
+
+	return SUCCESS;
+}
+
+/**
+ * @brief Configure over sampling ratio in standard sequencer mode
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] ratio - OSR ratio.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_std_seq_osr(struct ad469x_dev *dev, enum ad469x_osr_ratios ratio)
+{
+	int ret;
+
+	if (dev->ch_sequence == AD469x_single_cycle ||
+	    dev->ch_sequence == AD469x_two_cycle)
+		return FAILURE;
+
+	ret = ad469x_spi_write_mask(dev,
+		AD469x_REG_CONFIG_IN(0),
+		AD469x_REG_CONFIG_IN_OSR_MASK,
+		AD469x_REG_CONFIG_IN_OSR(ratio));
+	if (ret != SUCCESS)
+		return ret;
+
+	dev->capture_data_width = ad469x_device_resol[ratio];
+
+	return ret;
+}
+
+/**
+ * @brief Set channel sequence.
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] seq - Channel sequence.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_set_channel_sequence(struct ad469x_dev *dev,
+	enum ad469x_channel_sequencing seq)
+{
+	int32_t ret;
+
+	switch (seq) {
+	case AD469x_single_cycle:
+		ret = ad469x_spi_write_mask(dev,
+			AD469x_REG_SEQ_CTRL,
+			AD469x_SEQ_CTRL_STD_SEQ_EN_MASK,
+			AD469x_SEQ_CTRL_STD_SEQ_EN(0));
+		if (ret != SUCCESS)
+			return ret;
+
+		ret = ad469x_spi_write_mask(dev,
+			AD469x_REG_SEQ_CTRL,
+			AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK,
+			AD469x_SEQ_CTRL_NUM_SLOTS_AS(0));
+		if (ret != SUCCESS)
+			return ret;
+
+		ret = ad469x_spi_write_mask(dev,
+			AD469x_REG_SETUP,
+			AD469x_SETUP_CYC_CTRL_MASK,
+			AD469x_SETUP_CYC_CTRL_SINGLE(0));
+		if (ret != SUCCESS)
+			return ret;
+
+		ret = ad469x_seq_osr_clear(dev);
+		if (ret != SUCCESS)
+			return ret;
+
+		break;
+
+	case AD469x_two_cycle:
+		ret = ad469x_spi_write_mask(dev,
+			AD469x_REG_SEQ_CTRL,
+			AD469x_SEQ_CTRL_STD_SEQ_EN_MASK,
+			AD469x_SEQ_CTRL_STD_SEQ_EN(0));
+		if (ret != SUCCESS)
+			return ret;
+
+		ret = ad469x_spi_write_mask(dev,
+			AD469x_REG_SEQ_CTRL,
+			AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK,
+			AD469x_SEQ_CTRL_NUM_SLOTS_AS(0));
+		if (ret != SUCCESS)
+			return ret;
+
+		ret = ad469x_spi_write_mask(dev,
+			AD469x_REG_SETUP,
+			AD469x_SETUP_CYC_CTRL_MASK,
+			AD469x_SETUP_CYC_CTRL_SINGLE(1));
+		if (ret != SUCCESS)
+			return ret;
+
+		ret = ad469x_seq_osr_clear(dev);
+		if (ret != SUCCESS)
+			return ret;
+
+		break;
+
+	case AD469x_standard_seq:
+		ret = ad469x_spi_write_mask(dev,
+			AD469x_REG_SEQ_CTRL,
+			AD469x_SEQ_CTRL_STD_SEQ_EN_MASK,
+			AD469x_SEQ_CTRL_STD_SEQ_EN(1));
+		if (ret != SUCCESS)
+			return ret;
+
+		break;
+
+	case AD469x_advanced_seq:
+		ret = ad469x_spi_write_mask(dev,
+			AD469x_REG_SEQ_CTRL,
+			AD469x_SEQ_CTRL_STD_SEQ_EN_MASK,
+			AD469x_SEQ_CTRL_STD_SEQ_EN(0));
+		if (ret != SUCCESS)
+			return ret;
+
+		break;
+
+	default:
+		return FAILURE;
+		break;
+	}
+
+	dev->ch_sequence = seq;
+
+	return ret;
+}
+
+/**
+ * @brief Configure advanced sequencer number of slots, temp channel not
+ * included
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] num_slots - Number of slots, max value = 0x7f
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_adv_sequence_set_num_slots(struct ad469x_dev *dev,
+	uint8_t num_slots)
+{
+	int32_t ret;
+	uint8_t write_num_slots = 0;
+
+	if (num_slots)
+		write_num_slots = num_slots - 1;
+
+	ret = ad469x_spi_write_mask(dev,
+		AD469x_REG_SEQ_CTRL,
+		AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK,
+		AD469x_SEQ_CTRL_NUM_SLOTS_AS(write_num_slots));
+	if (ret != SUCCESS)
+		return ret;
+
+	dev->num_slots = num_slots;
+
+	return SUCCESS;
+}
+
+/**
+ * @brief Advanced sequencer, assign channel to a slot
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] slot - Slot number [0x00, 0x7f]
+ * @param [in] channel - Assigned channel [0x00, 0x0f].
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_adv_sequence_set_slot(struct ad469x_dev *dev,
+	uint8_t slot,
+	uint8_t channel)
+{
+	int32_t ret;
+	ret = ad469x_spi_reg_write(dev,
+		AD469x_REG_AS_SLOT(slot),
+		AD469x_REG_AS_SLOT_INX(channel));
+	if (ret != SUCCESS)
+		return ret;
+
+	dev->ch_slots[slot] = channel;
+
+	return SUCCESS;
+}
+
+/**
+ * @brief Configure standard sequencer channels
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] ch_mask - Extra channels to activate.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_std_sequence_ch(struct ad469x_dev *dev, uint32_t ch_mask)
+{
+	int32_t ret;
+
+	ret = ad469x_spi_reg_write(dev,
+		AD469x_REG_STD_SEQ_CONFIG,
+		0xff & ch_mask);
+	if (ret != SUCCESS)
+		return ret;
+
+	ret = ad469x_spi_reg_write(dev,
+		AD469x_REG_STD_SEQ_CONFIG + 1,
+		ch_mask >> 8);
+	if (ret != SUCCESS)
+		return ret;
+
+	dev->num_slots = hweight8(ch_mask);
+
+	return ret;
+}
+
+/**
+ * @brief Enable temperature read at the end of the sequence, for standard and
+ * advanced sequencer
+ * @param [in] dev - ad469x_dev device handler.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_sequence_enable_temp(struct ad469x_dev *dev)
+{
+	int32_t ret;
+
+	ret = ad469x_spi_write_mask(dev,
+		AD469x_REG_TEMP_CTRL,
+		AD469x_REG_TEMP_CTRL_TEMP_EN_MASK,
+		AD469x_REG_TEMP_CTRL_TEMP_EN(1));
+	if (ret != SUCCESS)
+		return ret;
+
+	dev->temp_enabled = true;
+
+	return ret;
+}
+
+/**
+ * @brief Disable temperature read at the end of the sequence, for standard and
+ * advanced sequencer
+ * @param [in] dev - ad469x_dev device handler.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_sequence_disable_temp(struct ad469x_dev *dev)
+{
+	int32_t ret;
+
+	ret = ad469x_spi_write_mask(dev,
+		AD469x_REG_TEMP_CTRL,
+		AD469x_REG_TEMP_CTRL_TEMP_EN_MASK,
+		AD469x_REG_TEMP_CTRL_TEMP_EN(0));
+	if (ret != SUCCESS)
+		return ret;
+
+	dev->temp_enabled = false;
+
+	return ret;
+}
+
+/**
+ * @brief Configure converter busy indicator to the output of the specified port
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] gp_sel - Port.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_set_busy(struct ad469x_dev *dev,
+	enum ad469x_busy_gp_sel gp_sel)
+{
+	int32_t ret;
+
+	ret = ad469x_spi_write_mask(dev,
+		AD469x_REG_GP_MODE,
+		AD469x_GP_MODE_BUSY_GP_EN_MASK,
+		AD469x_GP_MODE_BUSY_GP_EN(1));
+	if (ret != SUCCESS)
+		return ret;
+
+
+	ret = ad469x_spi_write_mask(dev,
+		AD469x_REG_GP_MODE,
+		AD469x_GP_MODE_BUSY_GP_SEL_MASK,
+		AD469x_GP_MODE_BUSY_GP_SEL(gp_sel));
+	if (ret != SUCCESS)
+		return ret;
+
+
+	return ret;
+}
+
+/**
+ * @brief Enter conversion mode.
+ *        To exit conversion mode send a 5 bit conversion mode command
+ *        AD469x_CMD_REG_CONFIG_MODE
+ * @param [in] dev - ad469x_dev device handler.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_enter_conversion_mode(struct ad469x_dev *dev)
+{
+	return ad469x_spi_write_mask(dev,
+				     AD469x_REG_SETUP,
+				     AD469x_SETUP_IF_MODE_MASK,
+				     AD469x_SETUP_IF_MODE_CONV);
+}
+
+/**
+ * @brief Exit conversion mode.
+ *        Enter register mode to read/write registers
+ * @param [in] dev - ad469x_dev device handler.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_exit_conversion_mode(struct ad469x_dev *dev)
+{
+	int32_t ret ; 
+	
+#if defined(ENABLE_SPI_ENGINE)
+	uint32_t commands_data[1], buf;
+	struct spi_engine_offload_message msg;
+	uint32_t spi_eng_msg_cmds[3] = {
+		CS_LOW,
+		WRITE_READ(1),
+		CS_HIGH
+	};
+
+	pwm_enable(dev->trigger_pwm_desc);
+
+	commands_data[0] = AD469x_CMD_REG_CONFIG_MODE << 8;
+
+	ret = spi_engine_offload_init(dev->spi_desc, dev->offload_init_param);
+	if (ret != SUCCESS)
+		return ret;
+
+	msg.commands = spi_eng_msg_cmds;
+	msg.no_commands = ARRAY_SIZE(spi_eng_msg_cmds);
+	msg.rx_addr = (uint32_t)&buf;
+	msg.commands_data = commands_data;
+
+	ret = spi_engine_offload_transfer(dev->spi_desc, msg, 1);
+	if (ret != SUCCESS)
+		return ret;
+
+	pwm_disable(dev->trigger_pwm_desc);
+	if (ret != SUCCESS)
+		return ret;
+#else
+	uint8_t cmd = AD469x_CMD_REG_CONFIG_MODE; 
+	
+	ret = spi_write_and_read(dev->spi_desc, &cmd, 1);
+	if (ret != SUCCESS)
+		return ret;
+#endif
+
+	return SUCCESS;
+}
+
+/**
+ * @brief Advanced sequencer, get util data bits in a sample
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] cur_sample - Current sample number
+ * @param [in] sample - Sample data
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+static int32_t ad469x_adv_seq_osr_get_util_data(struct ad469x_dev *dev,
+	uint16_t cur_sample,
+	uint32_t *sample)
+{
+	uint8_t cur_slot, cur_ch;
+
+	cur_slot = cur_sample % (dev->num_slots + dev->temp_enabled);
+	cur_ch = dev->ch_slots[cur_slot];
+
+	/* Temperature channel sample */
+	if (dev->temp_enabled && cur_slot == dev->num_slots)
+		return SUCCESS;
+
+	*sample = (*sample) >> (dev->capture_data_width -
+				dev->adv_seq_osr_resol[cur_ch]);
+
+	return SUCCESS;
+}
+
+/**
+ * @brief Read from device when converter has the channel sequencer activated.
+ *        Enter register mode to read/write registers
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [out] buf - data buffer.
+ * @param [in] samples - Number of samples per channel. For example, if  with
+ * ad469x_std_sequence_ch 2 channel where activated, buf will be filled with
+ * 10 samples for each of them. If temp is enable, the there will be an other 10
+ * samples for temperature
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_seq_read_data(struct ad469x_dev *dev,
+	uint32_t *buf,
+	uint16_t samples)
+{
+	int32_t ret;
+	uint16_t i;
+	uint32_t total_samples;
+
+	total_samples = samples * (dev->num_slots + dev->temp_enabled);
+	ret = ad469x_read_data(dev, 0, buf, total_samples);
+	if (ret != SUCCESS)
+		return ret;
+
+	if (dev->ch_sequence != AD469x_advanced_seq)
+		return SUCCESS;
+
+	for (i = 0; i < total_samples; i++) {
+		ret = ad469x_adv_seq_osr_get_util_data(dev, i, &buf[i]);
+		if (ret != SUCCESS)
+			return ret;
+	}
+
+	return SUCCESS;
+}
+
+/**
+ * @brief Read from device.
+ *        Enter register mode to read/write registers
+ * @param [in] dev - ad469x_dev device handler.
+ * @param [in] channel - ad469x selected channel.
+ * @param [out] buf - data buffer.
+ * @param [in] samples - sample number.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_read_data(struct ad469x_dev *dev,
+	uint8_t channel,
+	uint32_t *buf,
+	uint16_t samples)
+{
+	int32_t ret;
+
+#if defined(ENABLE_SPI_ENGINE)
+	uint32_t commands_data[1];
+	struct spi_engine_offload_message msg;
+	uint32_t spi_eng_msg_cmds[3] = {
+		CS_LOW,
+		WRITE_READ(1),
+		CS_HIGH
+	};
+	if (channel < AD469x_CHANNEL_NO)
+		commands_data[0] = AD469x_CMD_CONFIG_CH_SEL(channel) << 8;
+	else if (channel == AD469x_CHANNEL_TEMP)
+		commands_data[0] = AD469x_CMD_SEL_TEMP_SNSOR_CH << 8;
+	else
+		return FAILURE;
+
+	pwm_enable(dev->trigger_pwm_desc);
+
+	ret = spi_engine_offload_init(dev->spi_desc, dev->offload_init_param);
+	if (ret != SUCCESS)
+		return ret;
+	
+	msg.commands = spi_eng_msg_cmds;
+	msg.no_commands = ARRAY_SIZE(spi_eng_msg_cmds);
+	msg.rx_addr = (uint32_t)buf;
+	msg.commands_data = commands_data;
+
+	ret = spi_engine_offload_transfer(dev->spi_desc, msg, samples * 2);
+	if (ret != SUCCESS)
+		return ret;
+
+	if (dev->dcache_invalidate_range)
+		dev->dcache_invalidate_range(msg.rx_addr, samples * 4);
+#else 
+	// Dummy Data
+	dev->data[0] = 0x0;
+	dev->data[1] = 0x0;
+	ret = spi_write_and_read(dev->spi_desc, dev->data, (samples * 2));
+	if (ret != SUCCESS)
+		return FAILURE;
+		
+	*buf = (uint16_t)(dev->data[0] << 8) | dev->data[1];
+	
+#endif
+	
+	return ret;
+}
+
+/**
+ * Initialize the device.
+ * @param [out] device - The device structure.
+ * @param [in] init_param - The structure that contains the device initial
+ * 		parameters.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise.
+ */
+int32_t ad469x_init(struct ad469x_dev **device,
+	struct ad469x_init_param *init_param)
+{
+	struct ad469x_dev *dev;
+	int32_t ret;
+	uint8_t data = 0;
+
+	dev = (struct ad469x_dev *)malloc(sizeof(*dev));
+	if (!dev)
+		return FAILURE;
+
+#if defined(SPI_ENGINE)
+	ret = axi_clkgen_init(&dev->clkgen, init_param->clkgen_init);
+	if (ret != SUCCESS) {
+		printf("error: %s: axi_clkgen_init() failed\n",
+			init_param->clkgen_init->name);
+		goto error_dev;
+	}
+
+	ret = axi_clkgen_set_rate(dev->clkgen, init_param->axi_clkgen_rate);
+	if (ret != SUCCESS) {
+		printf("error: %s: axi_clkgen_set_rate() failed\n",
+			init_param->clkgen_init->name);
+		goto error_clkgen;
+	}
+	
+#endif
+
+	ret = ad469x_init_gpio(dev, init_param);
+	if (ret != SUCCESS)
+		goto error_gpio;
+	
+	ret = spi_init(&dev->spi_desc, init_param->spi_init);
+	if (ret != SUCCESS)
+		goto error_gpio;
+
+	dev->offload_init_param = init_param->offload_init_param;
+
+	dev->reg_access_speed = init_param->reg_access_speed;
+	dev->reg_data_width = init_param->reg_data_width;
+	dev->capture_data_width = init_param->capture_data_width;
+	dev->dev_id = init_param->dev_id;
+	dev->dcache_invalidate_range = init_param->dcache_invalidate_range;
+	dev->ch_sequence = AD469x_standard_seq;
+	dev->num_slots = 0;
+	dev->temp_enabled = false;
+	memset(dev->ch_slots, 0, sizeof(dev->ch_slots));
+	
+	ret = ad469x_spi_reg_write(dev, AD469x_REG_SCRATCH_PAD, AD469x_TEST_DATA);
+	if (ret != SUCCESS)
+		goto error_spi;
+	
+	ret = ad469x_spi_reg_read(dev, AD469x_REG_SCRATCH_PAD, &data);
+	if (ret != SUCCESS)
+		goto error_spi;
+
+ 	if (data != AD469x_TEST_DATA)
+		goto error_spi;
+
+	ret = ad469x_set_reg_access_mode(dev, AD469x_BYTE_ACCESS);
+	if (ret != SUCCESS)
+		goto error_spi;
+
+	ret = ad469x_set_busy(dev, AD469x_busy_gp0);
+	if (ret != SUCCESS)
+		goto error_spi;
+
+	ret = ad469x_seq_osr_clear(dev);
+	if (ret != SUCCESS)
+		goto error_spi;
+
+#if defined(SPI_ENGINE)
+	ret = pwm_init(&dev->trigger_pwm_desc, init_param->trigger_pwm_init);
+	if (ret != SUCCESS)
+		goto error_spi;
+#endif
+
+
+	*device = dev;
+
+	return ret;
+
+error_spi:
+	spi_remove(dev->spi_desc);
+error_gpio:
+	gpio_remove(dev->gpio_resetn);
+	
+#if defined(SPI_ENGINE)
+error_clkgen:
+	axi_clkgen_remove(dev->clkgen);
+error_dev:
+#endif
+	
+	free(dev);
+
+	return FAILURE;
+	
+}
+
+/**
+ * @brief Free the memory allocated by ad469x_init().
+ * @param [in] dev - Pointer to the device handler.
+ * @return \ref SUCCESS in case of success, \ref FAILURE otherwise
+ */
+int32_t ad469x_remove(struct ad469x_dev *dev)
+{
+	int32_t ret;
+
+	if (!dev)
+		return FAILURE;
+	
+	ret = spi_remove(dev->spi_desc);
+	if (ret != SUCCESS)
+		return ret;
+
+	ret = gpio_remove(dev->gpio_resetn);
+	if (ret != SUCCESS)
+		return ret;
+	
+	ret = gpio_remove(dev->gpio_convst);
+	if (ret != SUCCESS)
+		return ret;
+	
+	ret = gpio_remove(dev->gpio_busy);
+	if (ret != SUCCESS)
+		return ret;
+
+#if defined(SPI_ENGINE)
+	ret = pwm_remove(dev->trigger_pwm_desc);
+	if (ret != SUCCESS)
+		return ret;
+	
+	ret = axi_clkgen_remove(dev->clkgen);
+	if (ret != SUCCESS)
+		return ret;
+#endif
+
+	free(dev);
+
+	return ret;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/ad469x.h	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,370 @@
+/***************************************************************************//**
+ *   @file   ad469x.h
+ *   @brief  Header file for ad469x Driver.
+ *   @author Cristian Pop (cristian.pop@analog.com)
+********************************************************************************
+ * Copyright 2021(c) Analog Devices, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *  - Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  - Neither the name of Analog Devices, Inc. nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *  - The use of this software may or may not infringe the patent rights
+ *    of one or more patent holders.  This license does not release you
+ *    from the requirement that you obtain separate licenses from these
+ *    patent holders to use this software.
+ *  - Use of the software either in source or binary form, must be run
+ *    on or directly connected to an Analog Devices Inc. component.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+#ifndef SRC_AD469X_H_
+#define SRC_AD469X_H_
+
+// **** Note for User: SPI Standard/Engine selection **** //
+/* By default the Standard SPI protocol is used for communicating with eval board. 
+ * Uncomment the "ENABLE_SPI_ENGINE" macro to enable the SPI engine controller 
+ * framework. 
+ * */
+//#define ENABLE_SPI_ENGINE
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+#include <stdlib.h>
+#include <stdbool.h>
+
+#if defined(ENABLE_SPI_ENGINE)
+#include "spi_engine.h"
+#include "clk_axi_clkgen.h"
+#include "pwm.h"
+#else
+#include "spi.h"
+#endif
+
+/******************************************************************************/
+/********************** Macros and Constants Definitions **********************/
+/******************************************************************************/
+/* AD469x registers */
+#define AD469x_REG_IF_CONFIG_A		0x000
+#define AD469x_REG_IF_CONFIG_B		0x001
+#define AD469x_REG_DEVICE_TYPE		0x003
+#define AD469x_REG_DEVICE_ID_L		0x004
+#define AD469x_REG_DEVICE_ID_H		0x005
+#define AD469x_REG_SCRATCH_PAD		0x00A
+#define AD469x_REG_VENDOR_L		0x00C
+#define AD469x_REG_VENDOR_H		0x00D
+#define AD469x_REG_LOOP_MODE		0x00E
+#define AD469x_REG_IF_CONFIG_C		0x010
+#define AD469x_REG_IF_STATUS		0x011
+#define AD469x_REG_STATUS		0x014
+#define AD469x_REG_ALERT_STATUS1	0x015
+#define AD469x_REG_ALERT_STATUS2	0x016
+#define AD469x_REG_ALERT_STATUS3	0x017
+#define AD469x_REG_ALERT_STATUS4	0x018
+#define AD469x_REG_CLAMP_STATUS1	0x01A
+#define AD469x_REG_CLAMP_STATUS2	0x01B
+#define AD469x_REG_SETUP		0x020
+#define AD469x_REG_REF_CTRL		0x021
+#define AD469x_REG_SEQ_CTRL		0x022
+#define AD469x_REG_AC_CTRL		0x023
+#define AD469x_REG_STD_SEQ_CONFIG	0x024
+#define AD469x_REG_GPIO_CTRL		0x026
+#define AD469x_REG_GP_MODE		0x027
+#define AD469x_REG_GPIO_STATE		0x028
+#define AD469x_REG_TEMP_CTRL		0x029
+#define AD469x_REG_CONFIG_IN(x)		((x & 0x0F) | 0x30)
+#define AD469x_REG_AS_SLOT(x)		((x & 0x7F) | 0x100)
+
+/* 5-bit SDI Conversion Mode Commands */
+#define AD469x_CMD_REG_CONFIG_MODE		(0x0A << 3)
+#define AD469x_CMD_SEL_TEMP_SNSOR_CH		(0x0F << 3)
+#define AD469x_CMD_CONFIG_CH_SEL(x)		((0x10 | (0x0F & x)) << 3)
+
+/* AD469x_REG_SETUP */
+#define AD469x_SETUP_IF_MODE_MASK		(0x01 << 2)
+#define AD469x_SETUP_IF_MODE_CONV		(0x01 << 2)
+#define AD469x_SETUP_CYC_CTRL_MASK		(0x01 << 1)
+#define AD469x_SETUP_CYC_CTRL_SINGLE(x)		((x & 0x01) << 1)
+//Changed 
+#define AD469x_SETUP_STATUSBIT_MODE_MASK		(0x01 << 5)
+#define AD469x_SETUP_STATUSBIT_MODE_CONV		(0x01 << 5)
+
+/* AD469x_REG_GP_MODE */
+#define AD469x_GP_MODE_BUSY_GP_EN_MASK		(0x01 << 1)
+#define AD469x_GP_MODE_BUSY_GP_EN(x)		((x & 0x01) << 1)
+#define AD469x_GP_MODE_BUSY_GP_SEL_MASK		(0x01 << 4)
+#define AD469x_GP_MODE_BUSY_GP_SEL(x)		((x & 0x01) << 4)
+
+/* AD469x_REG_SEQ_CTRL */
+#define AD469x_SEQ_CTRL_STD_SEQ_EN_MASK		(0x01 << 7)
+#define AD469x_SEQ_CTRL_STD_SEQ_EN(x)		((x & 0x01) << 7)
+#define AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK	(0x7f << 0)
+#define AD469x_SEQ_CTRL_NUM_SLOTS_AS(x)		((x & 0x7f) << 0)
+
+/* AD469x_REG_TEMP_CTRL */
+#define AD469x_REG_TEMP_CTRL_TEMP_EN_MASK	(0x01 << 0)
+#define AD469x_REG_TEMP_CTRL_TEMP_EN(x)		((x & 0x01) << 0)
+
+/* AD469x_REG_AS_SLOT */
+#define AD469x_REG_AS_SLOT_INX(x)		((x & 0x0f) << 0)
+
+/* AD469x_REG_IF_CONFIG_C */
+#define AD469x_REG_IF_CONFIG_C_MB_STRICT_MASK	(0x01 << 5)
+#define AD469x_REG_IF_CONFIG_C_MB_STRICT(x)	((x & 0x01) << 5)
+
+/* AD469x_REG_CONFIG_INn */
+#define AD469x_REG_CONFIG_IN_OSR_MASK		(0x03 << 0)
+#define AD469x_REG_CONFIG_IN_OSR(x)		((x & 0x03) << 0)
+#define AD469x_REG_CONFIG_IN_HIZ_EN_MASK	(0x01 << 3)
+#define AD469x_REG_CONFIG_IN_HIZ_EN(x)		((x & 0x01) << 3)
+#define AD469x_REG_CONFIG_IN_PAIR_MASK		(0x03 << 4)
+#define AD469x_REG_CONFIG_IN_PAIR(x)		((x & 0x03) << 4)
+#define AD469x_REG_CONFIG_IN_MODE_MASK		(0x01 << 6)
+#define AD469x_REG_CONFIG_IN_MODE(x)		((x & 0x01) << 6)
+#define AD469x_REG_CONFIG_IN_TD_EN_MASK		(0x01 << 7)
+#define AD469x_REG_CONFIG_IN_TD_EN(x)		((x & 0x01) << 7)
+
+#define AD469x_CHANNEL(x)			(BIT(x) & 0xFFFF)
+#define AD469x_CHANNEL_NO			16
+#define AD469x_SLOTS_NO				0x80
+#define AD469x_CHANNEL_TEMP			16
+
+/******************************************************************************/
+/*************************** Types Declarations *******************************/
+/******************************************************************************/
+/**
+ * @enum ad469x_channel_sequencing
+ * @brief Channel sequencing modes
+ */
+enum ad469x_channel_sequencing {
+	/** Single cycle read */
+	AD469x_single_cycle,
+	/** Two cycle read */
+	AD469x_two_cycle,
+	/** Sequence trough channels, standard mode */
+	AD469x_standard_seq,
+	/** Sequence trough channels, advanced mode */
+	AD469x_advanced_seq,
+};
+
+/**
+  * @enum ad469x_busy_gp_sel
+  * @brief Busy state, possible general purpose pin selections
+  */
+enum ad469x_busy_gp_sel {
+	/** Busy on gp0 */
+	AD469x_busy_gp0 = 0,
+	/** Busy on gp3 */
+	AD469x_busy_gp3 = 1,
+};
+
+/**
+  * @enum ad469x_reg_access
+  * @brief Register access modes
+  */
+enum ad469x_reg_access {
+	AD469x_BYTE_ACCESS,
+	AD469x_WORD_ACCESS,
+};
+
+/**
+  * @enum ad469x_supported_dev_ids
+  * @brief Supported devices
+  */
+enum ad469x_supported_dev_ids {
+	ID_AD4695,
+	ID_AD4696,
+	ID_AD4697,
+};
+
+/**
+  * @enum ad469x_osr_ratios
+  * @brief Supported oversampling ratios
+  */
+enum ad469x_osr_ratios {
+	AD469x_OSR_1,
+	AD469x_OSR_4,
+	AD469x_OSR_16,
+	AD469x_OSR_64
+};
+
+/**
+ * @struct ad469x_init_param
+ * @brief  Structure containing the init parameters needed by the ad469x device
+ */
+struct ad469x_init_param {
+	/* SPI */
+	spi_init_param		*spi_init;
+	/* SPI module offload init */
+	struct spi_engine_offload_init_param *offload_init_param;
+	/* PWM generator init structure */
+	struct pwm_init_param	*trigger_pwm_init;
+	/** RESET GPIO initialization structure. */
+	struct gpio_init_param	*gpio_resetn;
+	//gpio_init_param * gpio_resetn;
+	/** CONVST GPIO initialization parameters */
+	struct gpio_init_param *gpio_convst;
+	/** BUSY GPIO initialization parameters */
+	struct gpio_init_param *gpio_busy;
+	/* Clock gen for hdl design init structure */
+	struct axi_clkgen_init	*clkgen_init;
+	/* Clock generator rate */
+	uint32_t		axi_clkgen_rate;
+	/* Register access speed */
+	uint32_t		reg_access_speed;
+	/* Register data width */
+	uint8_t		reg_data_width;
+	/* Capture data width */
+	uint8_t		capture_data_width;
+	/* Device Settings */
+	enum ad469x_supported_dev_ids dev_id;
+	/** Invalidate the Data cache for the given address range */
+	void(*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
+};
+
+/**
+ * @struct ad469x_dev
+ * @brief  Structure representing an ad469x device
+ */
+struct ad469x_dev {
+	/* SPI descriptor */
+	spi_desc		*spi_desc;
+	/* Clock gen for hdl design structure */
+	struct axi_clkgen	*clkgen;
+	/* Trigger conversion PWM generator descriptor */
+	struct pwm_desc		*trigger_pwm_desc;
+	/* SPI module offload init */
+	struct spi_engine_offload_init_param *offload_init_param;
+	/* Register access speed */
+	uint32_t		reg_access_speed;
+	/* Register data width */
+	uint8_t		reg_data_width;
+	/* Capture data width */
+	uint8_t		capture_data_width;
+	/* Device Settings */
+	enum ad469x_supported_dev_ids dev_id;
+	/** RESET GPIO handler. */
+	struct gpio_desc	*gpio_resetn;
+	/** CONVST GPIO descriptor */
+	struct gpio_desc *gpio_convst;
+	/** BUSY GPIO descriptor */
+	struct gpio_desc *gpio_busy;
+	/** Invalidate the Data cache for the given address range */
+	void(*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
+	/** Current channel sequence */
+	enum ad469x_channel_sequencing ch_sequence;
+	/** OSR resolution corresponding to each channel, when advanced
+	 * sequencer is selected. */
+	enum ad469x_osr_ratios adv_seq_osr_resol[AD469x_CHANNEL_NO];
+	/** Channel slots for advanced sequencer */
+	uint8_t ch_slots[AD469x_SLOTS_NO];
+	/** Temperature enabled for standard and advanced sequencer if set. */
+	bool temp_enabled;
+	/** Number of active channel slots, for advanced sequencer */
+	uint8_t num_slots;
+	/* Buffer to store the conv result */
+	uint8_t	data[16];
+};
+
+/******************************************************************************/
+/************************ Functions Declarations ******************************/
+/******************************************************************************/
+/* Read device register. */
+int32_t ad469x_spi_reg_read(struct ad469x_dev *dev,
+	uint16_t reg_addr,
+	uint8_t *reg_data);
+
+/* Write device register */
+int32_t ad469x_spi_reg_write(struct ad469x_dev *dev,
+	uint16_t reg_addr,
+	uint8_t reg_data);
+
+/* Read from device using a mask */
+int32_t ad469x_spi_read_mask(struct ad469x_dev *dev,
+	uint16_t reg_addr,
+	uint8_t mask,
+	uint8_t *data);
+
+/* Write to device using a mask */
+int32_t ad469x_spi_write_mask(struct ad469x_dev *dev,
+	uint16_t reg_addr,
+	uint8_t mask,
+	uint8_t data);
+
+/* Read data from device */
+int32_t ad469x_read_data(struct ad469x_dev *dev,
+	uint8_t channel,
+	uint32_t *buf,
+	uint16_t samples);
+
+/* Read from device when converter has the channel sequencer activated */
+int32_t ad469x_seq_read_data(struct ad469x_dev *dev,
+	uint32_t *buf,
+	uint16_t samples);
+
+/* Set channel sequence */
+int32_t ad469x_set_channel_sequence(struct ad469x_dev *dev,
+	enum ad469x_channel_sequencing seq);
+
+/* Configure standard sequencer enabled channels */
+int32_t ad469x_std_sequence_ch(struct ad469x_dev *dev,
+	uint32_t ch_mask);
+
+/* Configure advanced sequencer number of slots */
+int32_t ad469x_adv_sequence_set_num_slots(struct ad469x_dev *dev,
+	uint8_t num_slots);
+
+/* Advanced sequencer, assign channel to a slot */
+int32_t ad469x_adv_sequence_set_slot(struct ad469x_dev *dev,
+	uint8_t slot,
+	uint8_t channel);
+
+/* Enable temperature read at the end of the sequence, for standard and */
+int32_t ad469x_sequence_enable_temp(struct ad469x_dev *dev);
+
+/* Disable temperature read at the end of the sequence, for standard and */
+int32_t ad469x_sequence_disable_temp(struct ad469x_dev *dev);
+
+/* Configure over sampling ratio in advanced sequencer mode */
+int32_t ad469x_adv_seq_osr(struct ad469x_dev *dev,
+	uint16_t ch,
+	enum ad469x_osr_ratios ratio);
+
+/* Configure over sampling ratio in standard sequencer mode */
+int32_t ad469x_std_seq_osr(struct ad469x_dev *dev,
+	enum ad469x_osr_ratios ratio);
+
+/* Enter conversion mode */
+int32_t ad469x_enter_conversion_mode(struct ad469x_dev *dev);
+
+/* Exit conversion mode */
+int32_t ad469x_exit_conversion_mode(struct ad469x_dev *dev);
+
+/* Initialize the device. */
+int32_t ad469x_init(struct ad469x_dev **device,
+	struct ad469x_init_param *init_param);
+
+/* Remove the device and release resources. */
+int32_t ad469x_remove(struct ad469x_dev *dev);
+
+#endif /* SRC_AD469X_H_ */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/app_config.c	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,117 @@
+/***************************************************************************//**
+ *   @file    app_config.c
+ *   @brief   Application configurations module
+ *   @details This module contains the configurations needed for IIO application
+********************************************************************************
+ * Copyright (c) 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.
+*******************************************************************************/
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <stdbool.h>
+#include "app_config.h"
+#include "adc_data_capture.h"
+#include "error.h"
+#include "gpio.h"
+#include "irq.h"
+#include "pwm.h"
+#include "uart.h"
+
+/******************************************************************************/
+/************************ Macros/Constants ************************************/
+/******************************************************************************/
+
+/******************************************************************************/
+/*************************** Types Declarations *******************************/
+/******************************************************************************/
+
+/* External interrupt init parameters */
+static struct irq_init_param ext_int_init_params = {
+	.irq_ctrl_id = EXTERNAL_INT_ID1,
+	.extra = &ext_int_extra_init_params
+};
+
+/* External interrupt callback descriptor */
+static struct callback_desc ext_int_callback_desc = {
+	data_capture_callback,
+	NULL,
+	NULL
+};
+
+/* PWM init parameters */
+static struct pwm_init_param pwm_init_params = {
+	.id = EXT_TRIGGER_PIN,                          // GPIO used for PWM
+	.period_ns = CONV_TRIGGER_PERIOD_NSEC,          // PWM period in nsec
+	.duty_cycle_ns = CONV_TRIGGER_DUTY_CYCLE_NSEC	// PWM duty cycle in nsec
+}; 
+
+/* PWM descriptor */
+struct pwm_desc *pwm_desc;
+
+/* UART init parameters structure */
+struct uart_init_param uart_init_params = {
+	.device_id = NULL,
+	.baud_rate = IIO_UART_BAUD_RATE,
+	.extra = &uart_extra_init_params
+};
+
+/* External interrupt descriptor */
+struct irq_ctrl_desc *ext_int_desc;
+
+/******************************************************************************/
+/************************ Functions Prototypes ********************************/
+/******************************************************************************/
+
+/******************************************************************************/
+/************************ Functions Definitions *******************************/
+/******************************************************************************/
+
+/**
+ * @brief 	Initialize the IRQ contoller
+ * @return	SUCCESS in case of success, negative error code otherwise.
+ * @details	This function initialize the interrupts for system peripherals
+ */
+static int32_t init_interrupt(void)
+{
+	do {
+		/* Init interrupt controller for external interrupt */
+		if (irq_ctrl_init(&ext_int_desc, &ext_int_init_params) != SUCCESS) {
+			break;
+		}
+		/* Register a callback function for external interrupt */
+		if (irq_register_callback(ext_int_desc,
+			EXTERNAL_INT_ID1,
+			&ext_int_callback_desc) != SUCCESS) {
+			break;
+		}
+		return SUCCESS;
+	} while (0);
+
+	return FAILURE;
+}
+
+/**
+ * @brief 	Initializing system peripherals
+ * @return	SUCCESS in case of success, negative error code otherwise.
+ * @details	This function initializes system peripherals for the application
+ */
+int32_t init_system(void)
+{
+	if (init_interrupt() != SUCCESS)
+		return FAILURE;
+
+	/* Initialize the PWM interface to generate PWM signal
+	 * on conversion trigger event pin */
+	if (pwm_init(&pwm_desc, &pwm_init_params) != SUCCESS) {
+		return FAILURE;
+	}
+	
+	return SUCCESS;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/app_config.h	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,149 @@
+/*************************************************************************//**
+ *   @file   app_config.h
+ *   @brief  Configuration file for AD4696 device applications
+******************************************************************************
+* Copyright (c) 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.
+*****************************************************************************/
+
+#ifndef APP_CONFIG_H
+#define APP_CONFIG_H
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <stdint.h>
+
+/******************************************************************************/
+/********************** Macros and Constants Definition ***********************/
+/******************************************************************************/
+
+/* List of supported platforms*/
+#define	MBED_PLATFORM		1
+
+/* Select the active platform */
+#define ACTIVE_PLATFORM		MBED_PLATFORM
+
+#if (ACTIVE_PLATFORM == MBED_PLATFORM)
+#include "app_config_mbed.h"
+
+/* Used to form a VCOM serial number */
+#define	FIRMWARE_NAME	"ad4696_mbed_iio_application"
+
+/* Redefine the init params structure mapping w.r.t. platform */
+#define bsy_gpio_extra_init_params mbed_gpio_bsy_extra_init_params
+#define ext_int_extra_init_params mbed_ext_int_extra_init_params
+#define uart_extra_init_params mbed_uart_extra_init_params
+#define spi_extra_init_params mbed_spi_extra_init_params
+#else
+#error "No/Invalid active platform selected"
+#endif
+
+// **** Note for User: ACTIVE_DEVICE selection **** //
+/* Define the device type here from the list of below device type defines
+ * (one at a time. Defining more than one device can result into compile error).
+ * e.g. #define DEV_AD4696 -> This will make AD4696 as an ACTIVE_DEVICE.
+ * The ACTIVE_DEVICE is default set to AD4696 if device type is not defined.
+ * */
+
+//#define DEV_AD4696
+
+#if defined(DEV_AD4696)
+#define ACTIVE_DEVICE		ID_AD4696
+#define ACTIVE_DEVICE_NAME	"AD4696"
+#elif defined(DEV_AD4695)
+#define ACTIVE_DEVICE		ID_AD4695
+#define ACTIVE_DEVICE_NAME	"AD4695"
+#else
+#warning No/Unsupported ADxxxxy symbol defined. AD4696 defined
+#define DEV_AD4696
+#define ACTIVE_DEVICE		ID_AD4696
+#define ACTIVE_DEVICE_NAME	"AD4696"
+#endif
+
+#if defined(DEV_AD4696)
+#define	NO_OF_CHANNELS		16
+#define ADC_RESOLUTION		16
+#elif defined(DEV_AD4695)
+#define	NO_OF_CHANNELS		16
+#define ADC_RESOLUTION		16
+#else
+/* Default config for AD4696 */
+#define	NO_OF_CHANNELS		16
+#define ADC_RESOLUTION		16
+#endif
+
+// **** Note for User: Polarity Mode selection **** //
+/* Since the pin pairing option is same for all the channels in
+ * standard sequencer mode, hence polarity mode for all the 
+ * channels is also kept same to avoid stale ADC output codes. 
+ * Make sure to change the JP6 jumper position on the Eval board to A 
+ * to use the PSEUDO_BIPOLAR_MODE. 
+ * 
+ * Select Pseudo bipolar mode (default is unipolar mode) for all the channels.
+ * e.g. #define PSEUDO_BIPOLAR_MODE -> This will enable the PSEUDO_BIPOLAR_MODE 
+ * for all the channels. 
+ * */
+ 
+//#define PSEUDO_BIPOLAR_MODE
+
+/* Pins to be used an interrupt to trigger callback function */
+#define EXT_TRIGGER_PIN 	CONVST_PIN
+
+/* ADC max count (full scale value) for unipolar inputs */
+#define ADC_MAX_COUNT_UNIPOLAR	(uint32_t)((1 << ADC_RESOLUTION) - 1)
+
+/* ADC max count (full scale value) for bipolar inputs */
+#define ADC_MAX_COUNT_BIPOLAR	(uint32_t)(1 << (ADC_RESOLUTION-1))
+
+/* Baud rate for IIO application UART interface */
+#define IIO_UART_BAUD_RATE	(230400)
+
+/****** Macros used to form a VCOM serial number ******/
+#if !defined(DEVICE_NAME)
+#define DEVICE_NAME		"DEV_AD4696"
+#endif
+
+#if !defined(PLATFORM_NAME)
+#define PLATFORM_NAME	"SDP_K1"
+#endif
+/******/
+
+/* Enable the VirtualCOM port connection/interface. By default serial communication
+ * is physical UART */
+//#define USE_VIRTUAL_COM_PORT
+
+#if defined(USE_VIRTUAL_COM_PORT)
+/* Below USB configurations (VID and PID) are owned and assigned by ADI.
+ * If intended to distribute software further, use the VID and PID owned by your
+ * organization */
+#define VIRTUAL_COM_PORT_VID	0x0456
+#define VIRTUAL_COM_PORT_PID	0xb66c
+/* Serial number string is formed as: application name + device (target) name + platform (host) name */
+#define VIRTUAL_COM_SERIAL_NUM	(FIRMWARE_NAME "_" DEVICE_NAME "_" PLATFORM_NAME)
+#endif
+
+/******************************************************************************/
+/********************** Variables and User Defined Data Types *****************/
+/******************************************************************************/
+
+/******************************************************************************/
+/************************ Public Declarations *********************************/
+/******************************************************************************/
+
+/* UART init parameters structure */
+extern struct uart_init_param uart_init_params;
+
+/* PWM descriptor */
+extern struct pwm_desc *pwm_desc;
+
+/* Initializing system peripherals */
+int32_t init_system(void);
+
+#endif //APP_CONFIG_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/app_config_mbed.c	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,60 @@
+/***************************************************************************//**
+ *   @file    app_config_mbed.c
+ *   @brief   Application configurations module for Mbed platform
+********************************************************************************
+ * Copyright (c) 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.
+*******************************************************************************/
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <stdbool.h>
+#include "app_config.h"
+#include "app_config_mbed.h"
+
+/******************************************************************************/
+/************************ Macros/Constants ************************************/
+/******************************************************************************/
+
+/******************************************************************************/
+/******************** Variables and User Defined Data Types *******************/
+/******************************************************************************/
+
+/* UART Mbed platform specific init parameters */
+mbed_uart_init_param mbed_uart_extra_init_params = {
+#if defined(USE_VIRTUAL_COM_PORT)
+	.virtual_com_enable = true,
+	.vendor_id = VIRTUAL_COM_PORT_VID,
+	.product_id = VIRTUAL_COM_PORT_PID,
+	.serial_number = VIRTUAL_COM_SERIAL_NUM
+#else
+	.uart_tx_pin = UART_TX,
+	.uart_rx_pin = UART_RX,
+	.virtual_com_enable = false
+#endif
+};
+
+/* External interrupt Mbed platform specific parameters */
+mbed_irq_init_param mbed_ext_int_extra_init_params = {
+	.int_mode = EXT_IRQ_FALL,
+	.ext_int_pin = EXT_TRIGGER_PIN,
+	.int_obj_type = NULL
+};
+
+/* SPI Mbed platform specific parameters */
+mbed_spi_init_param mbed_spi_extra_init_params = {
+	.spi_clk_pin = SPI_SCK,
+	.spi_miso_pin = SPI_HOST_SDI,
+	.spi_mosi_pin = SPI_HOST_SDO
+};
+
+/* GPIO Mbed platform specific parameters */
+mbed_gpio_init_param mbed_gpio_bsy_extra_init_params = {
+	.pin_mode = PullNone
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/app_config_mbed.h	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,66 @@
+/***************************************************************************//**
+ *   @file    app_config_mbed.h
+ *   @brief   Header file for Mbed platform configurations
+********************************************************************************
+ * Copyright (c) 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.
+*******************************************************************************/
+
+#ifndef APP_CONFIG_MBED_H_
+#define APP_CONFIG_MBED_H_
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <stdint.h>
+#include <PinNames.h>
+
+#include "uart_extra.h"
+#include "irq_extra.h"
+#include "spi_extra.h"
+#include "gpio_extra.h"
+
+/******************************************************************************/
+/********************** Macros and Constants Definition ***********************/
+/******************************************************************************/
+
+/* Pin mapping for AD4696 w.r.t Arduino Headers */
+#define SPI_CSB		    D10
+#define SPI_HOST_SDO	D11
+#define SPI_HOST_SDI	D12
+#define SPI_SCK		    D13
+
+/* Common pin mapping on SDP-K1 */
+#define UART_TX		USBTX
+#define	UART_RX		USBRX
+
+/* Pins used to trigger, reset and/or read a new (periodic) conversion event */
+#define RESET_PIN	D5
+#define BUSY_PIN	D7 
+#define CONVST_PIN	D6
+
+/* Define the max possible sampling (or output data) rate for a given platform.
+ * This is also used to find the time period to trigger a periodic conversion event.
+ * Note: Max possible ODR is 62.5KSPS per channel for continuous data capture on
+ * IIO client. This is derived by testing the firmware on SDP-K1 controller board
+ * @22Mhz SPI clock. The max possible ODR can vary from board to board and
+ * data continuity is not guaranteed above this ODR on IIO oscilloscope */
+#define SAMPLING_RATE					(62500)
+#define CONV_TRIGGER_PERIOD_NSEC		(((float)(1.0 / SAMPLING_RATE) * 1000000) * 1000)
+#define CONV_TRIGGER_DUTY_CYCLE_NSEC	(CONV_TRIGGER_PERIOD_NSEC / 10)
+
+/******************************************************************************/
+/********************** Public/Extern Declarations ****************************/
+/******************************************************************************/
+
+extern mbed_gpio_init_param mbed_gpio_bsy_extra_init_params;
+extern mbed_irq_init_param mbed_ext_int_extra_init_params;
+extern mbed_uart_init_param mbed_uart_extra_init_params;
+extern mbed_spi_init_param mbed_spi_extra_init_params;
+
+#endif /* APP_CONFIG_MBED_H_ */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/iio_ad4696.c	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,633 @@
+/***************************************************************************//**
+ *   @file    iio_ad4696.c
+ *   @brief   Implementation of AD4696 IIO application interfaces
+ *   @details This module acts as an interface for AD4696 IIO application
+********************************************************************************
+ * Copyright (c) 2021 Analog Devices, Inc.
+ *
+ * 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.
+*******************************************************************************/
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <inttypes.h>
+#include <string.h>
+#include <math.h>
+
+#include "app_config.h"
+#include "tinyiiod.h"
+#include "iio_ad4696.h"
+#include "adc_data_capture.h"
+#include "ad4696_support.h"
+#include "ad4696_user_config.h"
+#include "error.h"
+
+/******************************************************************************/
+/************************ Macros/Constants ************************************/
+/******************************************************************************/
+
+/* ADC Raw to Voltage conversion default scale factor for IIO client */
+#if defined(PSEUDO_BIPOLAR_MODE)
+/* Device supports pseudo-bipolar mode only with INX- = Vref / 2 */
+#define DEFAULT_SCALE		(((DEFAULT_VREF  / 2) / ADC_MAX_COUNT_BIPOLAR) * 1000)
+#else
+#define DEFAULT_SCALE		((DEFAULT_VREF / ADC_MAX_COUNT_UNIPOLAR) * 1000)
+#endif
+
+/* Bytes per sample. This count should divide the total 256 bytes into 'n' equivalent
+ * ADC samples as IIO library requests only 256bytes of data at a time in a given
+ * data read query.
+ * For 1 to 8-bit ADC, bytes per sample = 1 (2^0)
+ * For 9 to 16-bit ADC, bytes per sample = 2 (2^1)
+ * For 17 to 32-bit ADC, bytes per sample = 4 (2^2)
+ **/
+#define	BYTES_PER_SAMPLE	sizeof(uint16_t)	// For ADC resolution of 16-bits
+
+/* Number of data storage bits (needed for IIO client to plot ADC data) */
+#define CHN_STORAGE_BITS	(BYTES_PER_SAMPLE * 8)
+
+/* Private IDs for IIO attributes */
+#define	IIO_RAW_ATTR_ID			0
+#define	IIO_SCALE_ATTR_ID		1
+#define	IIO_OFFSET_ATTR_ID		2
+
+/******************************************************************************/
+/*************************** Types Declarations *******************************/
+/******************************************************************************/
+
+/* Pointer to the struct representing the AD4696 IIO device */
+struct ad469x_dev *p_ad4696_dev = NULL;
+
+/* IIO interface descriptor */
+static struct iio_desc *p_ad4696_iio_desc;
+
+/* Device name */
+static const char dev_name [] = ACTIVE_DEVICE_NAME;
+
+/* Scale value per channel */
+static float attr_scale_val[NO_OF_CHANNELS] = {
+	DEFAULT_SCALE, DEFAULT_SCALE, DEFAULT_SCALE, DEFAULT_SCALE,
+	DEFAULT_SCALE, DEFAULT_SCALE, DEFAULT_SCALE, DEFAULT_SCALE,
+	DEFAULT_SCALE, DEFAULT_SCALE, DEFAULT_SCALE, DEFAULT_SCALE,
+	DEFAULT_SCALE, DEFAULT_SCALE, DEFAULT_SCALE, DEFAULT_SCALE
+};
+
+/* Flag to trigger new data capture */
+static bool adc_data_capture_started = false;
+
+/******************************************************************************/
+/************************ Functions Definitions *******************************/
+/******************************************************************************/
+
+/*!
+ * @brief	Getter/Setter for the raw, offset and scale attribute value
+ * @param	device- pointer to IIO device structure
+ * @param	buf- pointer to buffer holding attribute value
+ * @param	len- length of buffer string data
+ * @param	channel- pointer to IIO channel structure
+ * @param	id- Attribute ID
+ * @return	Number of characters read/written
+ */
+static ssize_t get_adc_raw(void *device,
+					char *buf,
+					size_t len,
+					const struct iio_ch_info *channel,
+					intptr_t id)
+{
+	static uint32_t adc_data_raw = 0;
+	int32_t offset = 0;
+
+	switch (id) {
+	case IIO_RAW_ATTR_ID:
+		/* Capture the raw adc data */
+		if (read_single_sample((uint32_t)channel->ch_num, &adc_data_raw) != FAILURE) {
+			return (ssize_t) sprintf(buf, "%d", adc_data_raw);
+		}
+		break;
+		
+	case IIO_SCALE_ATTR_ID:
+		return (ssize_t) sprintf(buf, "%f", attr_scale_val[channel->ch_num]);
+		break;
+		
+	case IIO_OFFSET_ATTR_ID:
+#if defined(PSEUDO_BIPOLAR_MODE)
+		if (adc_data_raw >= ADC_MAX_COUNT_BIPOLAR) {
+			offset = -ADC_MAX_COUNT_UNIPOLAR ;
+		}
+		else {
+			offset = 0;
+		}
+#endif
+		return (ssize_t) sprintf(buf, "%d", offset);
+		break;
+			
+	default:
+		break;
+	}
+
+	return -EINVAL;
+}
+
+static ssize_t set_adc_raw(void *device,
+					char *buf,
+					size_t len,
+					const struct iio_ch_info *channel,
+					intptr_t id)
+{
+	/* ADC raw value, offset factor and scale factor are fixed for given configurations set
+	 * in the firmware */
+	return len;
+}
+
+/*!
+ * @brief	Getter/Setter for the sampling frequency attribute value
+ * @param	device- pointer to IIO device structure
+ * @param	buf- pointer to buffer holding attribute value
+ * @param	len- length of buffer string data
+ * @param	channel- pointer to IIO channel structure
+ * @return	Number of characters read/written
+ * @Note	This attribute is used to define the timeout period in IIO
+ *			client during data capture.
+ *			Timeout = (number of requested samples * (1/sampling frequency)) + 1sec
+ *			e.g. if sampling frequency = 50SPS and requested samples = 400
+ *			Timeout = (400 * 0.02) + 1 = 9sec
+ */
+ssize_t get_sampling_frequency(void *device,
+			       char *buf,
+			       size_t len,
+			       const struct iio_ch_info *channel,
+			       intptr_t id)
+{
+	return (ssize_t) sprintf(buf, "%d", SAMPLING_RATE);
+}
+
+ssize_t set_sampling_frequency(void *device,
+			       char *buf,
+			       size_t len,
+			       const struct iio_ch_info *channel,
+			       intptr_t id)
+{
+	/* Sampling frequency determines the IIO client timeout. It is defined in the
+	* software and not allowed to change externally */
+	return -EINVAL;
+}
+
+/*!
+ * @brief	Read the debug register value
+ * @param	dev- Pointer to IIO device instance
+ * @param	reg- Register address to read from
+ * @param	readval- Pointer to variable to read data into
+ * @return	SUCCESS in case of success, negative value otherwise
+ */
+int32_t debug_reg_read(void *dev, uint32_t reg, uint8_t *readval)
+{
+	/* Read the data from device */
+	if (reg <= NUM_OF_REGISTERS) {
+		if (ad469x_spi_reg_read(dev, reg, readval) == SUCCESS) {
+			return SUCCESS;
+		}
+	}
+
+	return FAILURE;
+}
+
+/*!
+ * @brief	Write into the debug register
+ * @param	dev- Pointer to IIO device instance
+ * @param	reg- Register address to write into
+ * @param	writeval- Register value to write
+ * @return	SUCCESS in case of success, negative value otherwise
+ */
+int32_t debug_reg_write(void *dev, uint32_t reg, uint32_t writeval)
+{
+	if (reg <= NUM_OF_REGISTERS) {
+		if (ad469x_spi_reg_write(dev, reg, writeval) == SUCCESS) {
+			return SUCCESS;
+		}
+	}
+
+	return FAILURE;
+}
+
+/**
+ * @brief	Read buffer data corresponding to AD4696 IIO device
+ * @param	dev_instance[in] - IIO device instance
+ * @param	pbuf[out] - Pointer to output data buffer
+ * @param	offset[in] - Data buffer offset
+ * @param	bytes_count[in] - Number of bytes to read
+ * @param	ch_mask[in] - Channels select mask
+ * @return	SUCCESS in case of success or negative value otherwise
+ */
+static ssize_t iio_ad4696_read_data(void *dev_instance,
+				    char *pbuf,
+				    size_t offset,
+				    size_t bytes_count,
+				    uint32_t ch_mask)
+{
+	if (adc_data_capture_started == false) {
+		start_data_capture(ch_mask, AD469x_CHANNEL_NO);
+		adc_data_capture_started = true;
+	}
+
+	/* Read the buffered data */
+	return (ssize_t)read_buffered_data(pbuf, bytes_count, offset, ch_mask,
+		BYTES_PER_SAMPLE);
+
+}
+
+/**
+ * @brief	Transfer the device data into memory (optional)
+ * @param	dev_instance[in] - IIO device instance
+ * @param	bytes_count[in] - Number of bytes to read
+ * @param	ch_mask[in] - Channels select mask
+ * @return	SUCCESS in case of success or negative value otherwise
+ */
+static ssize_t iio_ad4696_transfer_dev_data(void *dev_instance,
+		size_t bytes_count, uint32_t ch_mask)
+{
+	store_requested_samples_count(bytes_count, BYTES_PER_SAMPLE);
+	return SUCCESS;
+}
+
+/**
+ * @brief	Perform tasks before new data transfer
+ * @param	dev_instance[in] - IIO device instance
+ * @param	ch_mask[in] - Channels select mask
+ * @return	SUCCESS in case of success or negative value otherwise
+ */
+static int32_t iio_ad4696_start_transfer(void *dev_instance, uint32_t ch_mask)
+{
+	return SUCCESS;
+}
+
+
+/**
+ * @brief	Perform tasks before end of current data transfer
+ * @param	dev_instance[in] - IIO device instance
+ * @return	SUCCESS in case of success or negative value otherwise
+ */
+static int32_t iio_ad4696_stop_transfer(void *dev)
+{
+	adc_data_capture_started = false;
+	stop_data_capture();
+
+	return SUCCESS;
+}
+
+/*********************************************************
+ *               IIO Attributes and Structures
+ ********************************************************/
+
+/* IIOD channels attributes list */
+struct iio_attribute channel_input_attributes[] = {
+	{
+		.name = "raw",
+		.show = get_adc_raw,
+		.store = set_adc_raw,
+		.priv = IIO_RAW_ATTR_ID
+	},
+	{
+		.name = "scale",
+		.show = get_adc_raw,
+		.store = set_adc_raw,
+		.priv = IIO_SCALE_ATTR_ID
+	},
+	{
+		.name = "offset",
+		.show = get_adc_raw,
+		.store = set_adc_raw,
+		.priv = IIO_OFFSET_ATTR_ID
+	},
+
+	END_ATTRIBUTES_ARRAY
+};
+
+/* IIOD device (global) attributes list */
+static struct iio_attribute global_attributes[] = {
+	{
+		.name = "sampling_frequency",
+		.show = get_sampling_frequency,
+		.store = set_sampling_frequency,
+	},
+
+	END_ATTRIBUTES_ARRAY
+};
+
+/* IIOD debug attributes list */
+static struct iio_attribute debug_attributes[] = {
+	{
+		.name = "direct_reg_access",
+		.show = NULL,
+		.store = NULL,
+	},
+
+	END_ATTRIBUTES_ARRAY
+};
+
+/* IIOD channels configurations */
+struct scan_type chn_scan = {
+#if defined(PSEUDO_BIPOLAR_MODE)
+	.sign = 's',
+#else
+	.sign = 'u',
+#endif
+	.realbits = CHN_STORAGE_BITS,
+	.storagebits = CHN_STORAGE_BITS,
+	.shift = 0,
+	.is_big_endian = false
+};
+static struct iio_channel iio_ad4696_channels[] = {
+	{
+		.name = "voltage0",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 0,
+		.scan_index = 0,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true,
+	},
+	{
+		.name = "voltage1",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 1,
+		.scan_index = 1,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage2",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 2,
+		.scan_index = 2,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage3",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 3,
+		.scan_index = 3,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage4",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 4,
+		.scan_index = 4,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage5",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 5,
+		.scan_index = 5,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage6",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 6,
+		.scan_index = 6,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage7",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 7,
+		.scan_index = 7,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage8",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 8,
+		.scan_index = 8,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true,
+	},
+	{
+		.name = "voltage9",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 9,
+		.scan_index = 9,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage10",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 10,
+		.scan_index = 10,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage11",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 11,
+		.scan_index = 11,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage12",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 12,
+		.scan_index = 12,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage13",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 13,
+		.scan_index = 13,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage14",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 14,
+		.scan_index = 14,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+	{
+		.name = "voltage15",
+		.ch_type = IIO_VOLTAGE,
+		.channel = 15,
+		.scan_index = 15,
+		.scan_type = &chn_scan,
+		.attributes = channel_input_attributes,
+		.ch_out = false,
+		.indexed = true
+	},
+};
+
+/**
+ * @brief	Init for reading/writing and parameterization of a
+ * 			ad4696 IIO device
+ * @param 	desc[in,out] - IIO device descriptor
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t iio_ad4696_init(struct iio_device **desc)
+{
+	struct iio_device *iio_ad4696_inst;
+
+	iio_ad4696_inst = calloc(1, sizeof(struct iio_device));
+	if (!iio_ad4696_inst) {
+		return FAILURE;
+	}
+
+	iio_ad4696_inst->num_ch = sizeof(iio_ad4696_channels) / sizeof(
+					  iio_ad4696_channels[0]);
+	iio_ad4696_inst->channels = iio_ad4696_channels;
+	iio_ad4696_inst->attributes = global_attributes;
+	iio_ad4696_inst->debug_attributes = debug_attributes;
+
+	iio_ad4696_inst->transfer_dev_to_mem = iio_ad4696_transfer_dev_data;
+	iio_ad4696_inst->transfer_mem_to_dev = NULL;
+	iio_ad4696_inst->read_data = iio_ad4696_read_data;
+	iio_ad4696_inst->write_data = NULL;
+	iio_ad4696_inst->prepare_transfer = iio_ad4696_start_transfer;
+	iio_ad4696_inst->end_transfer = iio_ad4696_stop_transfer;
+	iio_ad4696_inst->debug_reg_read = debug_reg_read;
+	iio_ad4696_inst->debug_reg_write = debug_reg_write;
+
+	*desc = iio_ad4696_inst;
+
+	return SUCCESS;
+}
+
+/**
+ * @brief Release resources allocated for IIO device
+ * @param desc[in] - IIO device descriptor
+ * @return SUCCESS in case of success, FAILURE otherwise
+ */
+static int32_t iio_ad4696_remove(struct iio_desc *desc)
+{
+	int32_t status;
+
+	if (!desc) {
+		return FAILURE;
+	}
+
+	status = iio_unregister(desc, (char *)dev_name);
+	if (status != SUCCESS) {
+		return FAILURE;
+	}
+
+	return SUCCESS;
+}
+
+
+/**
+ * @brief	Initialize the IIO interface for AD4696 IIO device
+ * @return	SUCCESS in case of success, FAILURE otherwise
+ */
+int32_t ad4696_iio_initialize(void)
+{
+	int32_t init_status;
+
+	/* IIO device descriptor */
+	struct iio_device *p_iio_ad4696_dev;
+
+	/* IIO interface init parameter */
+	struct iio_init_param iio_init_params = {
+		.phy_type = USE_UART,
+		{
+			&uart_init_params
+		}
+	};
+
+	/* Initialize AD4696 device and peripheral interface */
+	init_status = ad469x_init(&p_ad4696_dev, &ad4696_init_str);
+	if (init_status != SUCCESS) {
+		return init_status;
+	}
+
+	/* Initialize the IIO interface */
+	init_status = iio_init(&p_ad4696_iio_desc, &iio_init_params);
+	if (init_status != SUCCESS) {
+		return init_status;
+	}
+
+	/* Register and initialize the AD4696 device into IIO interface */
+	init_status = iio_ad4696_init(&p_iio_ad4696_dev);
+	if (init_status != SUCCESS) {
+		return init_status;
+	}
+
+	/* Register AD4696 IIO interface */
+	init_status = iio_register(p_ad4696_iio_desc, p_iio_ad4696_dev,
+				   (char *)dev_name, p_ad4696_dev, NULL,
+				   NULL);
+	if (init_status != SUCCESS) {
+		return init_status;
+	}
+
+	/* Init the system peripherals */
+	init_status = init_system();
+	if (init_status != SUCCESS) {
+		return init_status;
+	}
+
+	/* To enable manual trigger mode for operation */ 
+	init_status = ad4696_enable_manual_trigger_mode(p_ad4696_dev);
+	if (init_status != SUCCESS) {
+		return init_status;
+	}
+	
+	return SUCCESS;
+}
+
+/**
+ * @brief 	Run the AD4696 IIO event handler
+ * @return	none
+ * @details	This function monitors the new IIO client event
+ */
+void ad4696_iio_event_handler(void)
+{
+	while(1) {
+		(void)iio_step(p_ad4696_iio_desc);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/iio_ad4696.h	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,46 @@
+/***************************************************************************//**
+*   @file   iio_ad4696.h
+*   @brief  Header file of iio_ad4696
+********************************************************************************
+* Copyright (c) 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.
+*******************************************************************************/
+#ifndef IIO_AD4696_H_
+#define IIO_AD4696_H_
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+
+#include <stdio.h>
+#include <stdbool.h>
+
+#include "iio.h"
+#include "iio_types.h"
+
+/******************************************************************************/
+/****************************** Macros ****************************************/
+/******************************************************************************/
+
+/******************************************************************************/
+/*************************** Types Declarations *******************************/
+/******************************************************************************/
+
+/*  AD4696 global device instance for accessing device specific APIs */
+extern struct ad469x_dev *p_ad4696_dev;
+
+/******************************************************************************/
+/************************ Functions Declarations ******************************/
+/******************************************************************************/
+
+/* Init the IIO interface */
+int32_t ad4696_iio_initialize(void);
+
+/* Run the IIO event handler */
+void ad4696_iio_event_handler(void);
+
+#endif /* IIO_AD4696_H_ */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/libtinyiiod.lib	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,1 @@
+https://github.com/analogdevicesinc/libtinyiiod.git/#217b19a7e5719757ed90b48fdb57140f73d445fd
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/main.c	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,49 @@
+/***************************************************************************//**
+ *   @file    main.c
+ *   @brief   Main module for AD4696 IIO application
+ *   @details This module invokes the AD4696 IIO interfaces
+ *            through forever loop.
+********************************************************************************
+ * Copyright (c) 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.
+*******************************************************************************/
+
+/******************************************************************************/
+/***************************** Include Files **********************************/
+/******************************************************************************/
+#include <stdint.h>
+#include <assert.h>
+
+#include "iio_ad4696.h"
+#include "error.h"
+
+/******************************************************************************/
+/********************** Macros and Constants Definitions **********************/
+/******************************************************************************/
+
+/******************************************************************************/
+/************************ Functions Definitions *******************************/
+/******************************************************************************/
+
+/**
+ * @brief	Main entry point to application
+ * @return	none
+ */
+int main(void)
+{
+	/* Initialize the AD4696 IIO interface */
+	if (ad4696_iio_initialize() == FAILURE) {
+		assert(false);
+	}
+	
+	while (1) {
+		/* Monitor the IIO client events */
+		ad4696_iio_event_handler();
+	}
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/mbed_platform_drivers.lib	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/AnalogDevices/code/platform_drivers/#3c61197500c4
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/no-OS.lib	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,1 @@
+https://github.com/analogdevicesinc/no-OS/#d04b1a13621a09ed33f1ad3f83e4215433d9d60e
\ No newline at end of file
--- a/main.cpp	Wed Sep 29 11:39:40 2021 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/* Copyright (c) 2019 Analog Devices, Inc.  All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, 
-are permitted provided that the following conditions are met:
-  - Redistributions of source code must retain the above copyright notice, 
-  this list of conditions and the following disclaimer.
-  - Redistributions in binary form must reproduce the above copyright notice, 
-  this list of conditions and the following disclaimer in the documentation 
-  and/or other materials provided with the distribution.  
-  - Modified versions of the software must be conspicuously marked as such.
-  - This software is licensed solely and exclusively for use with processors/products 
-  manufactured by or for Analog Devices, Inc.
-  - This software may not be combined or merged with other code in any manner 
-  that would cause the software to become subject to terms and conditions which 
-  differ from those listed here.
-  - Neither the name of Analog Devices, Inc. nor the names of its contributors 
-  may be used to endorse or promote products derived from this software without 
-  specific prior written permission.
-  - The use of this software may or may not infringe the patent rights of one or 
-  more patent holders.  This license does not release you from the requirement 
-  that you obtain separate licenses from these patent holders to use this software.
-
-THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. AND CONTRIBUTORS "AS IS" AND 
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, 
-TITLE, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 
-NO EVENT SHALL ANALOG DEVICES, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES 
-(INCLUDING, BUT NOT LIMITED TO, DAMAGES ARISING OUT OF CLAIMS OF INTELLECTUAL 
-PROPERTY RIGHTS INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
-OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-2019-01-10-7CBSD SLA
-*/
-
-#include "mbed.h"
-
-// LED Blinking rate in milliseconds (Note: need to define the unit of a time duration i.e. seconds(s) or milliseconds(ms))
-#define SLEEP_TIME                  500ms
-
-// Initialise the digital pin that controls LED1
-DigitalOut led(LED1);
-// Initialise the serial object with TX and RX pins
-static BufferedSerial  serial_port(USBTX, USBRX);
-
-// The File handler is needed to allow printf commands to write to the terminal
-FileHandle *mbed::mbed_override_console(int fd)
-{
-    return &serial_port;
-}
-
-// main() runs in its own thread in the OS
-int main()
-{
-    // printing the Mbed OS version this example was written to the console
-    printf("This Application has been developed on Mbed OS version 6.4\r\n");
-    
-    // printing the actual Mbed OS version that this application is using to the console.
-    printf(
-        "Mbed OS version %d.%d.%d is what this applicaiton is currently using\r\n",
-        MBED_MAJOR_VERSION,
-        MBED_MINOR_VERSION,
-        MBED_PATCH_VERSION
-    );
-    
-    // The loop will toggle the LED every 500ms(SLEEP_TIME = 500ms) and print LED1s current state to the terminal
-    while (1) {
-        led = !led;          // toggle LED1 state
-        printf("LED1 state: %d \r\n", (uint8_t)led);
-        ThisThread::sleep_for(SLEEP_TIME);
-    }
-}
-
--- a/mbed-os.lib	Wed Sep 29 11:39:40 2021 +0000
+++ b/mbed-os.lib	Thu Sep 30 11:58:20 2021 +0100
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#8ef0a435b2356f8159dea8e427b2935d177309f8
+https://github.com/ARMmbed/mbed-os/#26606218ad9d1ee1c8781aa73774fd7ea3a7658e
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Thu Sep 30 11:58:20 2021 +0100
@@ -0,0 +1,23 @@
+{
+    "config": {
+        "usb_speed": {
+            "help": "USE_USB_OTG_FS or USE_USB_OTG_HS or USE_USB_HS_IN_FS",
+            "value": "USE_USB_OTG_HS"
+        }
+    },
+    "requires": ["bare-metal", "drivers-usb", "events"],
+    "macros": [
+        "TINYIIOD_VERSION_MAJOR=0",
+        "TINYIIOD_VERSION_MINOR=1",
+        "TINYIIOD_VERSION_GIT=\"0.1\"",
+        "IIOD_BUFFER_SIZE=0x1000",
+        "_USE_STD_INT_TYPES"
+    ],
+    "target_overrides": {
+        "*": {
+            "platform.default-serial-baud-rate": 230400,
+            "target.printf_lib": "std",
+            "target.device_has_remove": ["CAN"]
+        }
+    }
+}
\ No newline at end of file