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:
Thu Aug 18 14:46:42 2016 +0300
Revision:
26:1b988c505139
Parent:
24:dae7123d432a
WIP on cn0391: 86ec328 Improved compatibility with Linux systems

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Adrian Suciu 8:6e96c6b3c83f 1
Adrian Suciu 8:6e96c6b3c83f 2 /**
Adrian Suciu 8:6e96c6b3c83f 3 * @file config.h
Adrian Suciu 8:6e96c6b3c83f 4 * @brief Config file for driver diag tool
Adrian Suciu 8:6e96c6b3c83f 5 * @author Analog Devices Inc.
Adrian Suciu 8:6e96c6b3c83f 6 *
Adrian Suciu 8:6e96c6b3c83f 7 * For support please go to:
Adrian Suciu 8:6e96c6b3c83f 8 * Github: https://github.com/analogdevicesinc/mbed-adi
Adrian Suciu 8:6e96c6b3c83f 9 * Support: https://ez.analog.com/community/linux-device-drivers/microcontroller-no-os-drivers
Adrian Suciu 8:6e96c6b3c83f 10 * More: https://wiki.analog.com/resources/tools-software/mbed-drivers-all
Adrian Suciu 8:6e96c6b3c83f 11
Adrian Suciu 8:6e96c6b3c83f 12 ********************************************************************************
Adrian Suciu 8:6e96c6b3c83f 13 * Copyright 2016(c) Analog Devices, Inc.
Adrian Suciu 8:6e96c6b3c83f 14 *
Adrian Suciu 8:6e96c6b3c83f 15 * All rights reserved.
Adrian Suciu 8:6e96c6b3c83f 16 *
Adrian Suciu 8:6e96c6b3c83f 17 * Redistribution and use in source and binary forms, with or without
Adrian Suciu 8:6e96c6b3c83f 18 * modification, are permitted provided that the following conditions are met:
Adrian Suciu 8:6e96c6b3c83f 19 * - Redistributions of source code must retain the above copyright
Adrian Suciu 8:6e96c6b3c83f 20 * notice, this list of conditions and the following disclaimer.
Adrian Suciu 8:6e96c6b3c83f 21 * - Redistributions in binary form must reproduce the above copyright
Adrian Suciu 8:6e96c6b3c83f 22 * notice, this list of conditions and the following disclaimer in
Adrian Suciu 8:6e96c6b3c83f 23 * the documentation and/or other materials provided with the
Adrian Suciu 8:6e96c6b3c83f 24 * distribution.
Adrian Suciu 8:6e96c6b3c83f 25 * - Neither the name of Analog Devices, Inc. nor the names of its
Adrian Suciu 8:6e96c6b3c83f 26 * contributors may be used to endorse or promote products derived
Adrian Suciu 8:6e96c6b3c83f 27 * from this software without specific prior written permission.
Adrian Suciu 8:6e96c6b3c83f 28 * - The use of this software may or may not infringe the patent rights
Adrian Suciu 8:6e96c6b3c83f 29 * of one or more patent holders. This license does not release you
Adrian Suciu 8:6e96c6b3c83f 30 * from the requirement that you obtain separate licenses from these
Adrian Suciu 8:6e96c6b3c83f 31 * patent holders to use this software.
Adrian Suciu 8:6e96c6b3c83f 32 * - Use of the software either in source or binary form, must be run
Adrian Suciu 8:6e96c6b3c83f 33 * on or directly connected to an Analog Devices Inc. component.
Adrian Suciu 8:6e96c6b3c83f 34 *
Adrian Suciu 8:6e96c6b3c83f 35 * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
Adrian Suciu 8:6e96c6b3c83f 36 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
Adrian Suciu 8:6e96c6b3c83f 37 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
Adrian Suciu 8:6e96c6b3c83f 38 * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
Adrian Suciu 8:6e96c6b3c83f 39 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Adrian Suciu 8:6e96c6b3c83f 40 * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
Adrian Suciu 8:6e96c6b3c83f 41 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Adrian Suciu 8:6e96c6b3c83f 42 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Adrian Suciu 8:6e96c6b3c83f 43 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Adrian Suciu 8:6e96c6b3c83f 44 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Adrian Suciu 8:6e96c6b3c83f 45 *
Adrian Suciu 8:6e96c6b3c83f 46 ********************************************************************************/
Adrian Suciu 7:b62398a1d17a 47
Adrian Suciu 19:fb92949e59c9 48 //#define AD7791_PRESENT
Adrian Suciu 19:fb92949e59c9 49 //#define CN0216_PRESENT
Adrian Suciu 13:66c8e4ce4ff1 50 //#define AD7790_PRESENT
Adrian Suciu 13:66c8e4ce4ff1 51 //#define AD5270_PRESENT
Adrian Suciu 13:66c8e4ce4ff1 52 //#define CN0357_PRESENT
Adrian Suciu 26:1b988c505139 53 //#define ADXL362_PRESENT
Adrian Suciu 26:1b988c505139 54 //#define CN0398_PRESENT
Adrian Suciu 26:1b988c505139 55 //#define CN0397_PRESENT
Adrian Suciu 26:1b988c505139 56 #define CN0396_PRESENT
Adrian Suciu 26:1b988c505139 57 //#define AD7124_PRESENT
Adrian Suciu 7:b62398a1d17a 58 #define SPI_LOW_LEVEL
Adrian Suciu 7:b62398a1d17a 59
Adrian Suciu 13:66c8e4ce4ff1 60 #ifdef AD7791_PRESENT
Adrian Suciu 13:66c8e4ce4ff1 61 #include "AD7791.h"
Adrian Suciu 24:dae7123d432a 62 #include "AD7791_Diag.h"
Adrian Suciu 13:66c8e4ce4ff1 63 #endif
Adrian Suciu 13:66c8e4ce4ff1 64
Adrian Suciu 13:66c8e4ce4ff1 65 #ifdef CN0216_PRESENT
Adrian Suciu 13:66c8e4ce4ff1 66 #include "CN0216.h"
Adrian Suciu 24:dae7123d432a 67 #include "CN0216_Diag.h"
Adrian Suciu 13:66c8e4ce4ff1 68 #endif
Adrian Suciu 13:66c8e4ce4ff1 69
Adrian Suciu 7:b62398a1d17a 70 #ifdef AD7790_PRESENT
Adrian Suciu 7:b62398a1d17a 71 #include "AD7790.h"
Adrian Suciu 24:dae7123d432a 72 #include "AD7790_Diag.h"
Adrian Suciu 7:b62398a1d17a 73 #endif
Adrian Suciu 7:b62398a1d17a 74
Adrian Suciu 7:b62398a1d17a 75 #ifdef AD5270_PRESENT
Adrian Suciu 11:2e67c719ce37 76 #include "AD5270.h"
Adrian Suciu 24:dae7123d432a 77 #include "AD5270_Diag.h"
Adrian Suciu 7:b62398a1d17a 78 #endif
Adrian Suciu 7:b62398a1d17a 79
Adrian Suciu 7:b62398a1d17a 80 #ifdef CN0357_PRESENT
Adrian Suciu 11:2e67c719ce37 81 #include "CN0357.h"
Adrian Suciu 24:dae7123d432a 82 #include "CN0357_Diag.h"
Adrian Suciu 7:b62398a1d17a 83 #endif
Adrian Suciu 7:b62398a1d17a 84
Adrian Suciu 19:fb92949e59c9 85 #ifdef ADXL362_PRESENT
Adrian Suciu 19:fb92949e59c9 86 #include "ADXL362.h"
Adrian Suciu 24:dae7123d432a 87 #include "ADXL362_Diag.h"
Adrian Suciu 19:fb92949e59c9 88 #endif
Adrian Suciu 19:fb92949e59c9 89
Adrian Suciu 26:1b988c505139 90 #ifdef AD7124_PRESENT
Adrian Suciu 26:1b988c505139 91 #include "AD7124.h"
Adrian Suciu 26:1b988c505139 92 #include "AD7124_Diag.h"
Adrian Suciu 26:1b988c505139 93 #endif
Adrian Suciu 26:1b988c505139 94
Adrian Suciu 26:1b988c505139 95 #ifdef CN0398_PRESENT
Adrian Suciu 26:1b988c505139 96 #include "CN0398.h"
Adrian Suciu 26:1b988c505139 97 #include "CN0398_Diag.h"
Adrian Suciu 26:1b988c505139 98 #endif
Adrian Suciu 26:1b988c505139 99
Adrian Suciu 26:1b988c505139 100
Adrian Suciu 26:1b988c505139 101 #ifdef CN0397_PRESENT
Adrian Suciu 26:1b988c505139 102 #include "CN0397.h"
Adrian Suciu 26:1b988c505139 103 #include "CN0397_Diag.h"
Adrian Suciu 26:1b988c505139 104 #endif
Adrian Suciu 26:1b988c505139 105
Adrian Suciu 26:1b988c505139 106 #ifdef CN0396_PRESENT
Adrian Suciu 26:1b988c505139 107 #include "CN0396.h"
Adrian Suciu 26:1b988c505139 108 #include "CN0396_Diag.h"
Adrian Suciu 26:1b988c505139 109 #endif
Adrian Suciu 26:1b988c505139 110
Adrian Suciu 7:b62398a1d17a 111 using namespace std;
Adrian Suciu 7:b62398a1d17a 112 //------------------------------------
Adrian Suciu 7:b62398a1d17a 113 // Hyperterminal configuration
Adrian Suciu 7:b62398a1d17a 114 // 9600 bauds, 8-bit data, no parity
Adrian Suciu 7:b62398a1d17a 115 //------------------------------------
Adrian Suciu 7:b62398a1d17a 116
Adrian Suciu 7:b62398a1d17a 117 #ifdef SPI_LOW_LEVEL
Adrian Suciu 19:fb92949e59c9 118 //DigitalOut CSA_pin(D8); // cs adc
Adrian Suciu 26:1b988c505139 119 DigitalOut CSA_pin(D4); // cs accel
Adrian Suciu 7:b62398a1d17a 120 DigitalOut CSR_pin(D6); // cs rdac
Adrian Suciu 7:b62398a1d17a 121 SPI spibus(SPI_MOSI, SPI_MISO, SPI_SCK);
Adrian Suciu 7:b62398a1d17a 122 #endif
Adrian Suciu 7:b62398a1d17a 123
Adrian Suciu 13:66c8e4ce4ff1 124 #ifdef AD7791_PRESENT
Adrian Suciu 13:66c8e4ce4ff1 125 AD7791 ad7791(1.2, D8);
Adrian Suciu 13:66c8e4ce4ff1 126 AD7791_Diag ad7791diag(ad7791);
Adrian Suciu 13:66c8e4ce4ff1 127 #endif
Adrian Suciu 13:66c8e4ce4ff1 128
Adrian Suciu 13:66c8e4ce4ff1 129 #ifdef CN0216_PRESENT
Adrian Suciu 13:66c8e4ce4ff1 130 CN0216 cn0216;
Adrian Suciu 13:66c8e4ce4ff1 131 CN0216_Diag cn0216diag(cn0216);
Adrian Suciu 13:66c8e4ce4ff1 132 #endif
Adrian Suciu 13:66c8e4ce4ff1 133
Adrian Suciu 13:66c8e4ce4ff1 134
Adrian Suciu 7:b62398a1d17a 135 #ifdef AD7790_PRESENT
Adrian Suciu 7:b62398a1d17a 136 AD7790 ad7790(1.2, D8);
Adrian Suciu 7:b62398a1d17a 137 AD7790_Diag ad7790diag(ad7790);
Adrian Suciu 7:b62398a1d17a 138 #endif
Adrian Suciu 7:b62398a1d17a 139
Adrian Suciu 7:b62398a1d17a 140 #ifdef AD5270_PRESENT
Adrian Suciu 7:b62398a1d17a 141 AD5270 ad5270(D6, 20000);
Adrian Suciu 7:b62398a1d17a 142 AD5270_Diag ad5270diag(ad5270);
Adrian Suciu 7:b62398a1d17a 143 #endif
Adrian Suciu 7:b62398a1d17a 144
Adrian Suciu 7:b62398a1d17a 145 #ifdef CN0357_PRESENT
Adrian Suciu 7:b62398a1d17a 146 CN0357 cn0357;
Adrian Suciu 7:b62398a1d17a 147 CN0357_Diag cn0357diag(cn0357);
Adrian Suciu 13:66c8e4ce4ff1 148 #endif
Adrian Suciu 19:fb92949e59c9 149
Adrian Suciu 19:fb92949e59c9 150
Adrian Suciu 19:fb92949e59c9 151 #ifdef ADXL362_PRESENT
Adrian Suciu 19:fb92949e59c9 152 ADXL362 adxl362(D9);
Adrian Suciu 19:fb92949e59c9 153 ADXL362_Diag adxl362diag(adxl362);
Adrian Suciu 19:fb92949e59c9 154 #endif
Adrian Suciu 26:1b988c505139 155
Adrian Suciu 26:1b988c505139 156
Adrian Suciu 26:1b988c505139 157 #ifdef AD7124_PRESENT
Adrian Suciu 26:1b988c505139 158 AD7124 ad7124(D10);
Adrian Suciu 26:1b988c505139 159 AD7124_Diag ad7124diag(ad7124);
Adrian Suciu 26:1b988c505139 160 #endif
Adrian Suciu 26:1b988c505139 161
Adrian Suciu 26:1b988c505139 162 #ifdef CN0398_PRESENT
Adrian Suciu 26:1b988c505139 163 CN0398 cn0398(D10);
Adrian Suciu 26:1b988c505139 164 CN0398_Diag cn0398diag(cn0398);
Adrian Suciu 26:1b988c505139 165
Adrian Suciu 26:1b988c505139 166 #endif
Adrian Suciu 26:1b988c505139 167
Adrian Suciu 26:1b988c505139 168 #ifdef CN0397_PRESENT
Adrian Suciu 26:1b988c505139 169 CN0397 cn0397(D10);
Adrian Suciu 26:1b988c505139 170 CN0397_Diag cn0397diag(cn0397);
Adrian Suciu 26:1b988c505139 171 #endif
Adrian Suciu 26:1b988c505139 172
Adrian Suciu 26:1b988c505139 173 #ifdef CN0396_PRESENT
Adrian Suciu 26:1b988c505139 174 #include "AD5270_Diag.h"
Adrian Suciu 26:1b988c505139 175 CN0396 cn0396(D10, D6, D4);
Adrian Suciu 26:1b988c505139 176 CN0396_Diag cn0396diag(cn0396);
Adrian Suciu 26:1b988c505139 177 AD5270_Diag ad5270diag(cn0396.rdac);
Adrian Suciu 26:1b988c505139 178 #endif