A collection of Analog Devices drivers for the mbed platform

For additional information check out the mbed page of the Analog Devices wiki: https://wiki.analog.com/resources/tools-software/mbed-drivers-all

Files at this revision

API Documentation at this revision

Comitter:
Adrian Suciu
Date:
Thu Apr 21 18:01:41 2016 +0300
Parent:
10:b210cc8d6d41
Child:
12:6998bcb62025
Child:
13:66c8e4ce4ff1
Commit message:
Fixed filename case sensitivity issues

Changed in this revision

examples/cn0357_example/main.cpp Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/config.h Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/AD5270_diag.cpp Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/AD5270_diag.h Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/AD7790_diag.cpp Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/CN0357_diag.cpp Show annotated file Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/ad5270_diag.cpp Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/ad5270_diag.h Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/ad7790_diag.cpp Show diff for this revision Revisions of this file
examples/drvdiag/driver_wrapper/cn0357_diag.cpp Show diff for this revision Revisions of this file
libraries/CN0357/CN0357.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/CN0357/CN0357.h Show annotated file Show diff for this revision Revisions of this file
libraries/ad7790/AD7790.cpp Show annotated file Show diff for this revision Revisions of this file
libraries/cn0357/cn0357.cpp Show diff for this revision Revisions of this file
libraries/cn0357/cn0357.h Show diff for this revision Revisions of this file
--- a/examples/cn0357_example/main.cpp	Thu Apr 21 16:46:15 2016 +0300
+++ b/examples/cn0357_example/main.cpp	Thu Apr 21 18:01:41 2016 +0300
@@ -45,7 +45,7 @@
 *
 ********************************************************************************/
 #include "mbed.h"
-#include "cn0357.h"
+#include "CN0357.h"
 
 /** @mainpage
  * CN0357 single-supply, low noise, portable gas detector circuit using an
--- a/examples/drvdiag/config.h	Thu Apr 21 16:46:15 2016 +0300
+++ b/examples/drvdiag/config.h	Thu Apr 21 18:01:41 2016 +0300
@@ -52,17 +52,17 @@
 
 #ifdef AD7790_PRESENT
 #include "AD7790.h"
-#include "ad7790_diag.h"
+#include "AD7790_diag.h"
 #endif
 
 #ifdef AD5270_PRESENT
-#include "ad5270.h"
-#include "ad5270_diag.h"
+#include "AD5270.h"
+#include "AD5270_diag.h"
 #endif
 
 #ifdef CN0357_PRESENT
-#include "cn0357.h"
-#include "CN0357_Diag.h"
+#include "CN0357.h"
+#include "CN0357_diag.h"
 #endif
 
 using namespace std;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/AD5270_diag.cpp	Thu Apr 21 18:01:41 2016 +0300
@@ -0,0 +1,142 @@
+/**
+*   @file     ad5270_diag.cpp
+*   @brief    Source file for the AD5270 wrapper used by the driver diag
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(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 "mbed.h"
+#include <stdio.h>
+#include <vector>
+#include <string>
+#include "AD5270_diag.h"
+
+extern Serial pc;
+extern vector<string> cmdbuffer;
+
+AD5270_Diag::AD5270_Diag(AD5270& ad) : dut(ad)
+{
+
+}
+void AD5270_Diag::enable_50TP_programming()
+{
+    dut.enable_50TP_programming();
+    pc.printf("Enabled 50TP prog");
+
+}
+void AD5270_Diag::store_50TP()
+{
+    dut.store_50TP();
+    pc.printf("50TP stored");
+}
+void AD5270_Diag::disable_50TP_programming()
+{
+    dut.disable_50TP_programming();
+    pc.printf("Disabled 50TP prog");
+}
+
+void AD5270_Diag::write_RDAC()
+{
+    float res = strtof(cmdbuffer[1].c_str(), NULL);
+    dut.write_RDAC(res);
+    pc.printf("Wrote %f", res);
+}
+void AD5270_Diag::read_RDAC()
+{
+    pc.printf("Read %f", dut.read_RDAC());
+}
+void AD5270_Diag::write_cmd()
+{
+    uint8_t reg = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    uint8_t regVal = strtol(cmdbuffer[2].c_str(), NULL, 16);
+    pc.printf("Returned %x: ", dut.write_cmd(reg, regVal));
+}
+
+void AD5270_Diag::set_HiZ()
+{
+    pc.printf("SDO set to HiZ");
+    dut.set_SDO_HiZ();
+}
+
+void AD5270_Diag::read_50TP_last_address(void)
+{
+    pc.printf("Returned %x:", dut.read_50TP_last_address());
+}
+void AD5270_Diag::read_50TP_memory(void)
+{
+    uint8_t reg = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    pc.printf("Returned %x", dut.read_50TP_memory(reg));
+}
+
+void AD5270_Diag::write_ctrl_reg(void)
+{
+    uint8_t val = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    dut.write_ctrl_reg(val);
+    pc.printf("Wrote %x to ctrl_reg", val );
+}
+void AD5270_Diag::read_ctrl_reg(void)
+{
+    pc.printf("Read %x from ctrl_reg", dut.read_ctrl_reg());
+}
+
+void AD5270_Diag::reset_RDAC(void)
+{
+    dut.reset_RDAC();
+    pc.printf("Resetted rdac");
+}
+void AD5270_Diag::change_mode(void)
+{
+    uint8_t val = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    dut.change_mode(static_cast<AD5270::AD5270Modes_t>(val));
+    pc.printf("Changed mode to %x", val);
+}
+
+void AD5270_Diag::write_wiper_reg(void)
+{
+    uint16_t val = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    dut.write_wiper_reg(val);
+    pc.printf("Wrote %x to wiper", val);
+}
+void AD5270_Diag::read_wiper_reg(void)
+{
+    pc.printf("Read %x from wiper", dut.read_wiper_reg());
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/AD5270_diag.h	Thu Apr 21 18:01:41 2016 +0300
@@ -0,0 +1,81 @@
+/**
+*   @file     ad5270_diag.h
+*   @brief    Header file for the AD5270 wrapper used by the driver diag
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(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 AD5270_DIAG_H_
+#define AD5270_DIAG_H_
+#include "AD5270.h"
+
+class AD5270_Diag
+{
+public:
+    AD5270_Diag(AD5270& ad);
+    void enable_50TP_programming(void);
+    void store_50TP(void);
+    void disable_50TP_programming(void);
+
+    void write_RDAC(void);
+    void read_RDAC(void);
+    void write_cmd(void);
+    void set_HiZ(void);
+
+    void read_50TP_last_address(void);
+    void read_50TP_memory(void);
+
+    void write_ctrl_reg(void);
+    void read_ctrl_reg(void);
+
+    void reset_RDAC(void);
+    void change_mode(void);
+
+    void write_wiper_reg(void);
+    void read_wiper_reg(void);
+
+private:
+    AD5270& dut;
+};
+
+
+#endif /* AD5270_DIAG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/AD7790_diag.cpp	Thu Apr 21 18:01:41 2016 +0300
@@ -0,0 +1,128 @@
+/**
+*   @file     ad7790_diag.cpp
+*   @brief    Source file for the AD7790 wrapper used by the driver diag
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(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 "mbed.h"
+#include <stdio.h>
+#include <vector>
+#include <string>
+#include "AD7790_diag.h"
+
+extern Serial pc;
+extern vector<string> cmdbuffer;
+
+AD7790_Diag::AD7790_Diag(AD7790& ad) : dut(ad)
+{
+
+}
+
+void AD7790_Diag::init()
+{
+
+}
+void AD7790_Diag::reset()
+{
+    dut.reset();
+    pc.printf("Reseted AD7790");
+}
+
+void AD7790_Diag::write_mode()
+{
+    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    dut.write_mode_reg(regVal);
+    pc.printf("Wrote mode");
+}
+void AD7790_Diag::read_mode()
+{
+    pc.printf("Mode reg: %x ", dut.read_mode_reg());
+}
+
+void AD7790_Diag::write_filter()
+{
+    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    dut.write_filter_reg(regVal);
+    pc.printf("Wrote filter");
+}
+void AD7790_Diag::read_filter()
+{
+    pc.printf("Returned: %x ", dut.read_filter_reg());
+}
+void AD7790_Diag::read_data()
+{
+    pc.printf("Data reg: %x ", dut.read_data_reg());
+}
+
+void AD7790_Diag::read_status()
+{
+    pc.printf("Status reg: %x ", dut.read_status_reg());
+}
+
+void AD7790_Diag::read_u16()
+{
+    pc.printf("Data reg: %x ", dut.read_u16());
+}
+void AD7790_Diag::read_voltage()
+{
+    pc.printf("Voltage: %f ", dut.read_voltage());
+}
+void AD7790_Diag::set_continous_mode()
+{
+    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    dut.set_conversion_mode(static_cast<AD7790::AD7790Mode_t>(regVal));
+    pc.printf("Mode set to %d", regVal);
+}
+void AD7790_Diag::set_reference_voltage()
+{
+    float ref = strtof(cmdbuffer[1].c_str(), NULL);
+    dut.set_reference_voltage(ref);
+    pc.printf("Reference Voltage set to %f", ref);
+}
+
+void AD7790_Diag::set_channel()
+{
+    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
+    dut.set_channel(static_cast<AD7790::AD7790Channel_t>(regVal));
+    pc.printf("Mode set to %d", regVal);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/drvdiag/driver_wrapper/CN0357_diag.cpp	Thu Apr 21 18:01:41 2016 +0300
@@ -0,0 +1,78 @@
+/**
+*   @file     cn0357_diag.cpp
+*   @brief    Source file for the CN0357 wrapper used by the driver diag
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(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 "mbed.h"
+#include <stdio.h>
+#include <vector>
+#include <string>
+#include "CN0357_diag.h"
+
+extern Serial pc;
+extern vector<string> cmdbuffer;
+
+CN0357_Diag::CN0357_Diag(CN0357& cn) : dut(cn)
+{
+
+}
+void CN0357_Diag::set_RDAC()
+{
+    float res = strtof(cmdbuffer[1].c_str(), NULL);
+    dut.set_RDAC_value(res);
+    pc.printf("Wrote %f", res);
+
+}
+void CN0357_Diag::read_ppm(void)
+{
+    pc.printf("Wrote %f", dut.read_ppm());
+}
+
+void CN0357_Diag::set_sensor_param(void)
+{
+    float range = strtof(cmdbuffer[1].c_str(), NULL);
+    float sens = strtof(cmdbuffer[2].c_str(), NULL);
+    sens = sens * pow(10, -9);
+    pc.printf("Suggested RDAC val: %f ", dut.set_sensor_parameters(range, sens));
+}
--- a/examples/drvdiag/driver_wrapper/ad5270_diag.cpp	Thu Apr 21 16:46:15 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,142 +0,0 @@
-/**
-*   @file     ad5270_diag.cpp
-*   @brief    Source file for the AD5270 wrapper used by the driver diag
-*   @author   Analog Devices Inc.
-*
-* For support please go to:
-* Github: https://github.com/analogdevicesinc/mbed-adi
-* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
-* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
-
-********************************************************************************
-* Copyright 2016(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 "mbed.h"
-#include <stdio.h>
-#include <vector>
-#include <string>
-#include "AD5270_Diag.h"
-
-extern Serial pc;
-extern vector<string> cmdbuffer;
-
-AD5270_Diag::AD5270_Diag(AD5270& ad) : dut(ad)
-{
-
-}
-void AD5270_Diag::enable_50TP_programming()
-{
-    dut.enable_50TP_programming();
-    pc.printf("Enabled 50TP prog");
-
-}
-void AD5270_Diag::store_50TP()
-{
-    dut.store_50TP();
-    pc.printf("50TP stored");
-}
-void AD5270_Diag::disable_50TP_programming()
-{
-    dut.disable_50TP_programming();
-    pc.printf("Disabled 50TP prog");
-}
-
-void AD5270_Diag::write_RDAC()
-{
-    float res = strtof(cmdbuffer[1].c_str(), NULL);
-    dut.write_RDAC(res);
-    pc.printf("Wrote %f", res);
-}
-void AD5270_Diag::read_RDAC()
-{
-    pc.printf("Read %f", dut.read_RDAC());
-}
-void AD5270_Diag::write_cmd()
-{
-    uint8_t reg = strtol(cmdbuffer[1].c_str(), NULL, 16);
-    uint8_t regVal = strtol(cmdbuffer[2].c_str(), NULL, 16);
-    pc.printf("Returned %x: ", dut.write_cmd(reg, regVal));
-}
-
-void AD5270_Diag::set_HiZ()
-{
-    pc.printf("SDO set to HiZ");
-    dut.set_SDO_HiZ();
-}
-
-void AD5270_Diag::read_50TP_last_address(void)
-{
-    pc.printf("Returned %x:", dut.read_50TP_last_address());
-}
-void AD5270_Diag::read_50TP_memory(void)
-{
-    uint8_t reg = strtol(cmdbuffer[1].c_str(), NULL, 16);
-    pc.printf("Returned %x", dut.read_50TP_memory(reg));
-}
-
-void AD5270_Diag::write_ctrl_reg(void)
-{
-    uint8_t val = strtol(cmdbuffer[1].c_str(), NULL, 16);
-    dut.write_ctrl_reg(val);
-    pc.printf("Wrote %x to ctrl_reg", val );
-}
-void AD5270_Diag::read_ctrl_reg(void)
-{
-    pc.printf("Read %x from ctrl_reg", dut.read_ctrl_reg());
-}
-
-void AD5270_Diag::reset_RDAC(void)
-{
-    dut.reset_RDAC();
-    pc.printf("Resetted rdac");
-}
-void AD5270_Diag::change_mode(void)
-{
-    uint8_t val = strtol(cmdbuffer[1].c_str(), NULL, 16);
-    dut.change_mode(static_cast<AD5270::AD5270Modes_t>(val));
-    pc.printf("Changed mode to %x", val);
-}
-
-void AD5270_Diag::write_wiper_reg(void)
-{
-    uint16_t val = strtol(cmdbuffer[1].c_str(), NULL, 16);
-    dut.write_wiper_reg(val);
-    pc.printf("Wrote %x to wiper", val);
-}
-void AD5270_Diag::read_wiper_reg(void)
-{
-    pc.printf("Read %x from wiper", dut.read_wiper_reg());
-}
--- a/examples/drvdiag/driver_wrapper/ad5270_diag.h	Thu Apr 21 16:46:15 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/**
-*   @file     ad5270_diag.h
-*   @brief    Header file for the AD5270 wrapper used by the driver diag
-*   @author   Analog Devices Inc.
-*
-* For support please go to:
-* Github: https://github.com/analogdevicesinc/mbed-adi
-* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
-* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
-
-********************************************************************************
-* Copyright 2016(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 AD5270_DIAG_H_
-#define AD5270_DIAG_H_
-#include "ad5270.h"
-
-class AD5270_Diag
-{
-public:
-    AD5270_Diag(AD5270& ad);
-    void enable_50TP_programming(void);
-    void store_50TP(void);
-    void disable_50TP_programming(void);
-
-    void write_RDAC(void);
-    void read_RDAC(void);
-    void write_cmd(void);
-    void set_HiZ(void);
-
-    void read_50TP_last_address(void);
-    void read_50TP_memory(void);
-
-    void write_ctrl_reg(void);
-    void read_ctrl_reg(void);
-
-    void reset_RDAC(void);
-    void change_mode(void);
-
-    void write_wiper_reg(void);
-    void read_wiper_reg(void);
-
-private:
-    AD5270& dut;
-};
-
-
-#endif /* AD5270_DIAG_H_ */
--- a/examples/drvdiag/driver_wrapper/ad7790_diag.cpp	Thu Apr 21 16:46:15 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +0,0 @@
-/**
-*   @file     ad7790_diag.cpp
-*   @brief    Source file for the AD7790 wrapper used by the driver diag
-*   @author   Analog Devices Inc.
-*
-* For support please go to:
-* Github: https://github.com/analogdevicesinc/mbed-adi
-* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
-* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
-
-********************************************************************************
-* Copyright 2016(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 "mbed.h"
-#include <stdio.h>
-#include <vector>
-#include <string>
-#include "AD7790_Diag.h"
-
-extern Serial pc;
-extern vector<string> cmdbuffer;
-
-AD7790_Diag::AD7790_Diag(AD7790& ad) : dut(ad)
-{
-
-}
-
-void AD7790_Diag::init()
-{
-
-}
-void AD7790_Diag::reset()
-{
-    dut.reset();
-    pc.printf("Reseted AD7790");
-}
-
-void AD7790_Diag::write_mode()
-{
-    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
-    dut.write_mode_reg(regVal);
-    pc.printf("Wrote mode");
-}
-void AD7790_Diag::read_mode()
-{
-    pc.printf("Mode reg: %x ", dut.read_mode_reg());
-}
-
-void AD7790_Diag::write_filter()
-{
-    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
-    dut.write_filter_reg(regVal);
-    pc.printf("Wrote filter");
-}
-void AD7790_Diag::read_filter()
-{
-    pc.printf("Returned: %x ", dut.read_filter_reg());
-}
-void AD7790_Diag::read_data()
-{
-    pc.printf("Data reg: %x ", dut.read_data_reg());
-}
-
-void AD7790_Diag::read_status()
-{
-    pc.printf("Status reg: %x ", dut.read_status_reg());
-}
-
-void AD7790_Diag::read_u16()
-{
-    pc.printf("Data reg: %x ", dut.read_u16());
-}
-void AD7790_Diag::read_voltage()
-{
-    pc.printf("Voltage: %f ", dut.read_voltage());
-}
-void AD7790_Diag::set_continous_mode()
-{
-    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
-    dut.set_conversion_mode(static_cast<AD7790::AD7790Mode_t>(regVal));
-    pc.printf("Mode set to %d", regVal);
-}
-void AD7790_Diag::set_reference_voltage()
-{
-    float ref = strtof(cmdbuffer[1].c_str(), NULL);
-    dut.set_reference_voltage(ref);
-    pc.printf("Reference Voltage set to %f", ref);
-}
-
-void AD7790_Diag::set_channel()
-{
-    uint8_t regVal = strtol(cmdbuffer[1].c_str(), NULL, 16);
-    dut.set_channel(static_cast<AD7790::AD7790Channel_t>(regVal));
-    pc.printf("Mode set to %d", regVal);
-}
--- a/examples/drvdiag/driver_wrapper/cn0357_diag.cpp	Thu Apr 21 16:46:15 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/**
-*   @file     cn0357_diag.cpp
-*   @brief    Source file for the CN0357 wrapper used by the driver diag
-*   @author   Analog Devices Inc.
-*
-* For support please go to:
-* Github: https://github.com/analogdevicesinc/mbed-adi
-* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
-* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
-
-********************************************************************************
-* Copyright 2016(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 "mbed.h"
-#include <stdio.h>
-#include <vector>
-#include <string>
-#include "CN0357_Diag.h"
-
-extern Serial pc;
-extern vector<string> cmdbuffer;
-
-CN0357_Diag::CN0357_Diag(CN0357& cn) : dut(cn)
-{
-
-}
-void CN0357_Diag::set_RDAC()
-{
-    float res = strtof(cmdbuffer[1].c_str(), NULL);
-    dut.set_RDAC_value(res);
-    pc.printf("Wrote %f", res);
-
-}
-void CN0357_Diag::read_ppm(void)
-{
-    pc.printf("Wrote %f", dut.read_ppm());
-}
-
-void CN0357_Diag::set_sensor_param(void)
-{
-    float range = strtof(cmdbuffer[1].c_str(), NULL);
-    float sens = strtof(cmdbuffer[2].c_str(), NULL);
-    sens = sens * pow(10, -9);
-    pc.printf("Suggested RDAC val: %f ", dut.set_sensor_parameters(range, sens));
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/CN0357/CN0357.cpp	Thu Apr 21 18:01:41 2016 +0300
@@ -0,0 +1,229 @@
+/**
+*   @file     cn0357.cpp
+*   @brief    Source file for CN0357
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* Product: www.analog.com/EVAL-CN0357-ARDZ
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(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 "mbed.h"
+#include "AD7790.h"
+#include "AD5270.h"
+#include "CN0357.h"
+
+/**
+ * @brief CN0357 constructor
+ * @param CSAD7790 - (optional)chip select of the AD7790
+ * @param CSAD5270 - (optional)chip select of the AD5270
+ * @param MOSI - (optional)pin of the SPI interface
+ * @param MISO - (optional)pin of the SPI interface
+ * @param SCK  - (optional)pin of the SPI interface
+ */
+CN0357::CN0357(PinName CSAD7790, PinName CSAD5270, PinName MOSI, PinName MISO,
+               PinName SCK) :
+    _vref(1.2), _sensor_sensitivity(0), _sensor_range(0), _RDACvalue(0),
+    ad7790(_vref, CSAD7790, MOSI, MISO, SCK), ad5270(CSAD5270, 20000.0, MOSI, MISO, SCK)
+
+{
+}
+
+/**
+ * @brief initializes the AD7790 and the AD5270
+ * @param range - range of the sensor used (in ppm)
+ * @param sensitivity - sensitivity of the sensor (A/ppm)
+ * @param jp - (optional)jumper configuration of the CN0357
+ * @param mode_val - (optional)if jp is set to InternalADC, configures the mode register of the Internal ADC
+ * @param filter_val - (optional)if jp is set to InternalADC, configures the filter register of the Internal ADC
+ */
+void CN0357::init(float range, float sensitivity, JumperConfig_t jp, uint8_t mode_val, uint8_t filter_val)
+{
+    ad5270.frequency(500000);
+    ad7790.frequency(500000);
+
+    float resistance = set_sensor_parameters(range, sensitivity);
+
+    if(jp == INTERNAL_AD7790) {
+        _AD7790_init(mode_val, filter_val);
+    }
+    _rdac_init(resistance);
+}
+
+/**
+ * @brief initializes the RDAC and sets SDO to HiZ
+ * @param resistance - resistance value to initialize the RDAC
+ * @return
+ */
+void CN0357::_rdac_init(float resistance)
+{
+    /* RDAC initialization*/
+    /* Compute for the nearest RDAC value from given resistance and save data to the structure */
+    set_RDAC_value(resistance);
+    /* Set AD5270 SDO to Hi-Z */
+    ad5270.set_SDO_HiZ();
+}
+
+/**
+ * @brief initializes the AD7790
+ * @param mode_val -  configures the mode register of the Internal ADC
+ * @param filter_val -  configures the filter register of the Internal ADC
+ */
+void CN0357::_AD7790_init(uint8_t mode_val, uint8_t filter_val)
+{
+    ad7790.reset();
+    wait_ms(50);
+
+    ad7790.write_mode_reg(mode_val);
+    wait_us(2);
+
+    ad7790.write_filter_reg(filter_val);
+    wait_ms(50);
+}
+
+/**
+ * @brief reads the status register of the AD7790
+ * @return status register value
+ */
+uint8_t CN0357::read_adc_status(void)
+{
+    return ad7790.read_status_reg();
+}
+
+/**
+ * @brief reads the ADC and computes the sensor voltage
+ * @return sensor voltage
+ */
+float CN0357::read_sensor_voltage(void)
+{
+    return ad7790.read_voltage();
+}
+
+/**
+ * @brief reads the data register of the AD7790
+ * @return data register value
+ */
+uint16_t CN0357::read_sensor(void)
+{
+    return ad7790.read_u16();
+}
+
+/**
+ * @brief reads and computes the sensor reading in PPM
+ * @return value of the sensor reading in PPM
+ */
+float CN0357::read_ppm()
+{
+    return calc_ppm(ad7790.read_voltage()); /* Convert voltage to Gas concentration*/
+}
+
+/**
+ * @brief computes a value in PPM from a reading received as a param
+ * @param adcVoltage - voltage to be converted to PPM
+ * @return sensor value in PPM
+ */
+float CN0357::calc_ppm(float adcVoltage)
+{
+    float fConcentration = 0;
+    fConcentration = (fabs(adcVoltage) / _RDACvalue) / _sensor_sensitivity;
+    return fConcentration;
+}
+
+/**
+ * @brief computes voltage from a 16 bit ADC value received as a parameter
+ * @param data - ADC value
+ * @return sensor voltage
+ */
+float CN0357::data_to_voltage(uint16_t data)
+{
+    return ad7790.data_to_voltage(data);
+}
+
+/**
+ * @brief sets a new value for the RDAC
+ * @param resistance new value for the resistance
+ * @return none
+ */
+void CN0357::set_RDAC_value(float resistance)
+{
+    _RDACvalue = ad5270.write_RDAC(resistance);
+}
+
+/**
+ * @brief getter method for RDAC value
+ * @return value of the RDAC in ohms
+ */
+float CN0357::get_RDAC_value()
+{
+    return _RDACvalue;
+}
+
+/**
+ * @brief set sensor range and sensitivity
+ * sets sensor range, sensitivity
+ * returns suggested resistance value for feedback resistor
+ * @param range - range of the sensor used (in ppm)
+ * @param sensitivity - sensitivity of the sensor (in A/ppm)
+ * @return suggested resistance value for feedback resistor
+ */
+float CN0357::set_sensor_parameters(float range, float sensitivity)
+{
+    _sensor_sensitivity = static_cast<float>(sensitivity);
+    _sensor_range = range;
+    return (_vref / (static_cast<float>(_sensor_range * _sensor_sensitivity)));
+}
+
+/**
+ * @brief getter method for sensor sensitivity
+ * @return sensor sensitivity (in A/ppm)
+ */
+float CN0357::get_sensor_sensitivity()
+{
+    return _sensor_sensitivity;
+}
+
+/**
+ * @brief getter method for sensor range
+ * @return sensor range (in ppm)
+ */
+float CN0357::get_sensor_range()
+{
+    return _sensor_range;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libraries/CN0357/CN0357.h	Thu Apr 21 18:01:41 2016 +0300
@@ -0,0 +1,102 @@
+/**
+*   @file     cn0357.h
+*   @brief    Header file for CN0357
+*   @author   Analog Devices Inc.
+*
+* For support please go to:
+* Github: https://github.com/analogdevicesinc/mbed-adi
+* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
+* Product: www.analog.com/EVAL-CN0357-ARDZ
+* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
+
+********************************************************************************
+* Copyright 2016(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 CN0357_H
+#define CN0357_H
+
+#include "mbed.h"
+#include "AD7790.h"
+#include "AD5270.h"
+
+/**
+ * @brief EVAL-CN0357 toxic gas sensor shield
+ */
+class CN0357
+{
+public:
+
+private:
+    float _vref;
+    float _sensor_sensitivity;
+    float _sensor_range;
+    float _RDACvalue;
+public:
+    AD7790 ad7790; ///< AD7790 instance - can be used for manual overriding
+    AD5270 ad5270; ///< AD5270 instance - can be used for manual overriding
+
+    /// CN0357 shield jumper configuration
+    typedef enum {
+        INTERNAL_AD7790 = 0, 	///< The shield's AD7790 is used
+        EXTERNAL_ADC			///< Sensor analog output is routed to A1 pin of the shield
+    } JumperConfig_t;
+
+    CN0357(PinName CSAD7790 = D8, PinName CSAD5270 = D6, PinName MOSI = SPI_MOSI, PinName MISO = SPI_MISO, PinName SCK = SPI_SCK);
+    void init(float range, float sensitivity, JumperConfig_t jp = INTERNAL_AD7790, uint8_t mode_val = _DEFAULT_MODE_VAL, uint8_t filter_val = _DEFAULT_FILTER_VAL);
+
+    uint8_t  read_adc_status(void);
+    uint16_t read_sensor(void);
+    float read_sensor_voltage(void);
+    float data_to_voltage(uint16_t data);
+    float calc_ppm(float adcVoltage);
+    float read_ppm(void);
+
+    void  set_RDAC_value(float resistor_val);
+    float get_RDAC_value(void);
+    float set_sensor_parameters(float range, float sensitivity);
+    float get_sensor_range(void);
+    float get_sensor_sensitivity(void);
+
+private:
+    const static int _RESET = 0xff;
+    const static int _DEFAULT_MODE_VAL = AD7790::MD1 | AD7790::MD0; // POWERDOWN MODE
+    const static int _DEFAULT_FILTER_VAL = AD7790::FS0 | AD7790::FS1 | AD7790::FS2;
+    void _rdac_init(float resistanceValue);
+    void _AD7790_init(uint8_t mode_val, uint8_t filter_val);
+
+};
+
+#endif // CN0357_H
--- a/libraries/ad7790/AD7790.cpp	Thu Apr 21 16:46:15 2016 +0300
+++ b/libraries/ad7790/AD7790.cpp	Thu Apr 21 18:01:41 2016 +0300
@@ -47,7 +47,7 @@
 
 #include <stdint.h>
 #include "mbed.h"
-#include "ad7790.h"
+#include "AD7790.h"
 
 /**
  * @brief AD7790 constructor, sets CS pin and SPI format
--- a/libraries/cn0357/cn0357.cpp	Thu Apr 21 16:46:15 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,229 +0,0 @@
-/**
-*   @file     cn0357.cpp
-*   @brief    Source file for CN0357
-*   @author   Analog Devices Inc.
-*
-* For support please go to:
-* Github: https://github.com/analogdevicesinc/mbed-adi
-* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
-* Product: www.analog.com/EVAL-CN0357-ARDZ
-* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
-
-********************************************************************************
-* Copyright 2016(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 "mbed.h"
-#include "AD7790.h"
-#include "AD5270.h"
-#include "cn0357.h"
-
-/**
- * @brief CN0357 constructor
- * @param CSAD7790 - (optional)chip select of the AD7790
- * @param CSAD5270 - (optional)chip select of the AD5270
- * @param MOSI - (optional)pin of the SPI interface
- * @param MISO - (optional)pin of the SPI interface
- * @param SCK  - (optional)pin of the SPI interface
- */
-CN0357::CN0357(PinName CSAD7790, PinName CSAD5270, PinName MOSI, PinName MISO,
-               PinName SCK) :
-    _vref(1.2), _sensor_sensitivity(0), _sensor_range(0), _RDACvalue(0),
-    ad7790(_vref, CSAD7790, MOSI, MISO, SCK), ad5270(CSAD5270, 20000.0, MOSI, MISO, SCK)
-
-{
-}
-
-/**
- * @brief initializes the AD7790 and the AD5270
- * @param range - range of the sensor used (in ppm)
- * @param sensitivity - sensitivity of the sensor (A/ppm)
- * @param jp - (optional)jumper configuration of the CN0357
- * @param mode_val - (optional)if jp is set to InternalADC, configures the mode register of the Internal ADC
- * @param filter_val - (optional)if jp is set to InternalADC, configures the filter register of the Internal ADC
- */
-void CN0357::init(float range, float sensitivity, JumperConfig_t jp, uint8_t mode_val, uint8_t filter_val)
-{
-    ad5270.frequency(500000);
-    ad7790.frequency(500000);
-
-    float resistance = set_sensor_parameters(range, sensitivity);
-
-    if(jp == INTERNAL_AD7790) {
-        _AD7790_init(mode_val, filter_val);
-    }
-    _rdac_init(resistance);
-}
-
-/**
- * @brief initializes the RDAC and sets SDO to HiZ
- * @param resistance - resistance value to initialize the RDAC
- * @return
- */
-void CN0357::_rdac_init(float resistance)
-{
-    /* RDAC initialization*/
-    /* Compute for the nearest RDAC value from given resistance and save data to the structure */
-    set_RDAC_value(resistance);
-    /* Set AD5270 SDO to Hi-Z */
-    ad5270.set_SDO_HiZ();
-}
-
-/**
- * @brief initializes the AD7790
- * @param mode_val -  configures the mode register of the Internal ADC
- * @param filter_val -  configures the filter register of the Internal ADC
- */
-void CN0357::_AD7790_init(uint8_t mode_val, uint8_t filter_val)
-{
-    ad7790.reset();
-    wait_ms(50);
-
-    ad7790.write_mode_reg(mode_val);
-    wait_us(2);
-
-    ad7790.write_filter_reg(filter_val);
-    wait_ms(50);
-}
-
-/**
- * @brief reads the status register of the AD7790
- * @return status register value
- */
-uint8_t CN0357::read_adc_status(void)
-{
-    return ad7790.read_status_reg();
-}
-
-/**
- * @brief reads the ADC and computes the sensor voltage
- * @return sensor voltage
- */
-float CN0357::read_sensor_voltage(void)
-{
-    return ad7790.read_voltage();
-}
-
-/**
- * @brief reads the data register of the AD7790
- * @return data register value
- */
-uint16_t CN0357::read_sensor(void)
-{
-    return ad7790.read_u16();
-}
-
-/**
- * @brief reads and computes the sensor reading in PPM
- * @return value of the sensor reading in PPM
- */
-float CN0357::read_ppm()
-{
-    return calc_ppm(ad7790.read_voltage()); /* Convert voltage to Gas concentration*/
-}
-
-/**
- * @brief computes a value in PPM from a reading received as a param
- * @param adcVoltage - voltage to be converted to PPM
- * @return sensor value in PPM
- */
-float CN0357::calc_ppm(float adcVoltage)
-{
-    float fConcentration = 0;
-    fConcentration = (fabs(adcVoltage) / _RDACvalue) / _sensor_sensitivity;
-    return fConcentration;
-}
-
-/**
- * @brief computes voltage from a 16 bit ADC value received as a parameter
- * @param data - ADC value
- * @return sensor voltage
- */
-float CN0357::data_to_voltage(uint16_t data)
-{
-    return ad7790.data_to_voltage(data);
-}
-
-/**
- * @brief sets a new value for the RDAC
- * @param resistance new value for the resistance
- * @return none
- */
-void CN0357::set_RDAC_value(float resistance)
-{
-    _RDACvalue = ad5270.write_RDAC(resistance);
-}
-
-/**
- * @brief getter method for RDAC value
- * @return value of the RDAC in ohms
- */
-float CN0357::get_RDAC_value()
-{
-    return _RDACvalue;
-}
-
-/**
- * @brief set sensor range and sensitivity
- * sets sensor range, sensitivity
- * returns suggested resistance value for feedback resistor
- * @param range - range of the sensor used (in ppm)
- * @param sensitivity - sensitivity of the sensor (in A/ppm)
- * @return suggested resistance value for feedback resistor
- */
-float CN0357::set_sensor_parameters(float range, float sensitivity)
-{
-    _sensor_sensitivity = static_cast<float>(sensitivity);
-    _sensor_range = range;
-    return (_vref / (static_cast<float>(_sensor_range * _sensor_sensitivity)));
-}
-
-/**
- * @brief getter method for sensor sensitivity
- * @return sensor sensitivity (in A/ppm)
- */
-float CN0357::get_sensor_sensitivity()
-{
-    return _sensor_sensitivity;
-}
-
-/**
- * @brief getter method for sensor range
- * @return sensor range (in ppm)
- */
-float CN0357::get_sensor_range()
-{
-    return _sensor_range;
-}
--- a/libraries/cn0357/cn0357.h	Thu Apr 21 16:46:15 2016 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/**
-*   @file     cn0357.h
-*   @brief    Header file for CN0357
-*   @author   Analog Devices Inc.
-*
-* For support please go to:
-* Github: https://github.com/analogdevicesinc/mbed-adi
-* Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
-* Product: www.analog.com/EVAL-CN0357-ARDZ
-* More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
-
-********************************************************************************
-* Copyright 2016(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 CN0357_H
-#define CN0357_H
-
-#include "mbed.h"
-#include "ad7790.h"
-#include "ad5270.h"
-
-/**
- * @brief EVAL-CN0357 toxic gas sensor shield
- */
-class CN0357
-{
-public:
-
-private:
-    float _vref;
-    float _sensor_sensitivity;
-    float _sensor_range;
-    float _RDACvalue;
-public:
-    AD7790 ad7790; ///< AD7790 instance - can be used for manual overriding
-    AD5270 ad5270; ///< AD5270 instance - can be used for manual overriding
-
-    /// CN0357 shield jumper configuration
-    typedef enum {
-        INTERNAL_AD7790 = 0, 	///< The shield's AD7790 is used
-        EXTERNAL_ADC			///< Sensor analog output is routed to A1 pin of the shield
-    } JumperConfig_t;
-
-    CN0357(PinName CSAD7790 = D8, PinName CSAD5270 = D6, PinName MOSI = SPI_MOSI, PinName MISO = SPI_MISO, PinName SCK = SPI_SCK);
-    void init(float range, float sensitivity, JumperConfig_t jp = INTERNAL_AD7790, uint8_t mode_val = _DEFAULT_MODE_VAL, uint8_t filter_val = _DEFAULT_FILTER_VAL);
-
-    uint8_t  read_adc_status(void);
-    uint16_t read_sensor(void);
-    float read_sensor_voltage(void);
-    float data_to_voltage(uint16_t data);
-    float calc_ppm(float adcVoltage);
-    float read_ppm(void);
-
-    void  set_RDAC_value(float resistor_val);
-    float get_RDAC_value(void);
-    float set_sensor_parameters(float range, float sensitivity);
-    float get_sensor_range(void);
-    float get_sensor_sensitivity(void);
-
-private:
-    const static int _RESET = 0xff;
-    const static int _DEFAULT_MODE_VAL = AD7790::MD1 | AD7790::MD0; // POWERDOWN MODE
-    const static int _DEFAULT_FILTER_VAL = AD7790::FS0 | AD7790::FS1 | AD7790::FS2;
-    void _rdac_init(float resistanceValue);
-    void _AD7790_init(uint8_t mode_val, uint8_t filter_val);
-
-};
-
-#endif // CN0357_H