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

Committer:
Adrian Suciu
Date:
Mon Nov 07 16:27:12 2016 +0200
Revision:
33:c3ec596a29c2
Added CN0391, CN0396 and CN0397 shields

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Adrian Suciu 33:c3ec596a29c2 1 /**
Adrian Suciu 33:c3ec596a29c2 2 * @file ad7124_diag.h
Adrian Suciu 33:c3ec596a29c2 3 * @brief Header file for the AD7124 wrapper used by the driver diag
Adrian Suciu 33:c3ec596a29c2 4 * @author Analog Devices Inc.
Adrian Suciu 33:c3ec596a29c2 5 *
Adrian Suciu 33:c3ec596a29c2 6 * For support please go to:
Adrian Suciu 33:c3ec596a29c2 7 * Github: https://github.com/analogdevicesinc/mbed-adi
Adrian Suciu 33:c3ec596a29c2 8 * Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
Adrian Suciu 33:c3ec596a29c2 9 * More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
Adrian Suciu 33:c3ec596a29c2 10
Adrian Suciu 33:c3ec596a29c2 11 ********************************************************************************
Adrian Suciu 33:c3ec596a29c2 12 * Copyright 2016(c) Analog Devices, Inc.
Adrian Suciu 33:c3ec596a29c2 13 *
Adrian Suciu 33:c3ec596a29c2 14 * All rights reserved.
Adrian Suciu 33:c3ec596a29c2 15 *
Adrian Suciu 33:c3ec596a29c2 16 * Redistribution and use in source and binary forms, with or without
Adrian Suciu 33:c3ec596a29c2 17 * modification, are permitted provided that the following conditions are met:
Adrian Suciu 33:c3ec596a29c2 18 * - Redistributions of source code must retain the above copyright
Adrian Suciu 33:c3ec596a29c2 19 * notice, this list of conditions and the following disclaimer.
Adrian Suciu 33:c3ec596a29c2 20 * - Redistributions in binary form must reproduce the above copyright
Adrian Suciu 33:c3ec596a29c2 21 * notice, this list of conditions and the following disclaimer in
Adrian Suciu 33:c3ec596a29c2 22 * the documentation and/or other materials provided with the
Adrian Suciu 33:c3ec596a29c2 23 * distribution.
Adrian Suciu 33:c3ec596a29c2 24 * - Neither the name of Analog Devices, Inc. nor the names of its
Adrian Suciu 33:c3ec596a29c2 25 * contributors may be used to endorse or promote products derived
Adrian Suciu 33:c3ec596a29c2 26 * from this software without specific prior written permission.
Adrian Suciu 33:c3ec596a29c2 27 * - The use of this software may or may not infringe the patent rights
Adrian Suciu 33:c3ec596a29c2 28 * of one or more patent holders. This license does not release you
Adrian Suciu 33:c3ec596a29c2 29 * from the requirement that you obtain separate licenses from these
Adrian Suciu 33:c3ec596a29c2 30 * patent holders to use this software.
Adrian Suciu 33:c3ec596a29c2 31 * - Use of the software either in source or binary form, must be run
Adrian Suciu 33:c3ec596a29c2 32 * on or directly connected to an Analog Devices Inc. component.
Adrian Suciu 33:c3ec596a29c2 33 *
Adrian Suciu 33:c3ec596a29c2 34 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
Adrian Suciu 33:c3ec596a29c2 35 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
Adrian Suciu 33:c3ec596a29c2 36 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Adrian Suciu 33:c3ec596a29c2 37 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
Adrian Suciu 33:c3ec596a29c2 38 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Adrian Suciu 33:c3ec596a29c2 39 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
Adrian Suciu 33:c3ec596a29c2 40 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Adrian Suciu 33:c3ec596a29c2 41 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Adrian Suciu 33:c3ec596a29c2 42 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Adrian Suciu 33:c3ec596a29c2 43 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Adrian Suciu 33:c3ec596a29c2 44 *
Adrian Suciu 33:c3ec596a29c2 45 ********************************************************************************/
Adrian Suciu 33:c3ec596a29c2 46
Adrian Suciu 33:c3ec596a29c2 47 #ifndef AD7124_DIAG_H_
Adrian Suciu 33:c3ec596a29c2 48 #define AD7124_DIAG_H_
Adrian Suciu 33:c3ec596a29c2 49 #include "AD7124.h"
Adrian Suciu 33:c3ec596a29c2 50
Adrian Suciu 33:c3ec596a29c2 51 class AD7124_Diag
Adrian Suciu 33:c3ec596a29c2 52 {
Adrian Suciu 33:c3ec596a29c2 53 public:
Adrian Suciu 33:c3ec596a29c2 54 AD7124_Diag(AD7124& ad);
Adrian Suciu 33:c3ec596a29c2 55
Adrian Suciu 33:c3ec596a29c2 56 void setup();
Adrian Suciu 33:c3ec596a29c2 57 void mvpInit();
Adrian Suciu 33:c3ec596a29c2 58 void enable_channel(int channel);
Adrian Suciu 33:c3ec596a29c2 59 void disable_channel(int channel);
Adrian Suciu 33:c3ec596a29c2 60 void enable_current_source(int current_source_channel);
Adrian Suciu 33:c3ec596a29c2 61 void write_reg();
Adrian Suciu 33:c3ec596a29c2 62 void read_reg();
Adrian Suciu 33:c3ec596a29c2 63 void reset();
Adrian Suciu 33:c3ec596a29c2 64 void read_data();
Adrian Suciu 33:c3ec596a29c2 65 void read_volt();
Adrian Suciu 33:c3ec596a29c2 66 void start_single_conversion();
Adrian Suciu 33:c3ec596a29c2 67 float data_to_voltage(uint32_t data);
Adrian Suciu 33:c3ec596a29c2 68
Adrian Suciu 33:c3ec596a29c2 69 private:
Adrian Suciu 33:c3ec596a29c2 70 AD7124& dut;
Adrian Suciu 33:c3ec596a29c2 71 };
Adrian Suciu 33:c3ec596a29c2 72
Adrian Suciu 33:c3ec596a29c2 73
Adrian Suciu 33:c3ec596a29c2 74 #endif /* AD5270_DIAG_H_ */