| 1 | /***************************************************************************//** |
| 2 | * @file Command.h |
| 3 | * @brief Header file of the commands driver. |
| 4 | * @author Lucian Sin ([email protected]) |
| 5 | * |
| 6 | ******************************************************************************** |
| 7 | * Copyright 2013(c) Analog Devices, Inc. |
| 8 | * |
| 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions are met: |
| 13 | * - Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer. |
| 15 | * - Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in |
| 17 | * the documentation and/or other materials provided with the |
| 18 | * distribution. |
| 19 | * - Neither the name of Analog Devices, Inc. nor the names of its |
| 20 | * contributors may be used to endorse or promote products derived |
| 21 | * from this software without specific prior written permission. |
| 22 | * - The use of this software may or may not infringe the patent rights |
| 23 | * of one or more patent holders. This license does not release you |
| 24 | * from the requirement that you obtain separate licenses from these |
| 25 | * patent holders to use this software. |
| 26 | * - Use of the software either in source or binary form, must be run |
| 27 | * on or directly connected to an Analog Devices Inc. component. |
| 28 | * |
| 29 | * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
| 30 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
| 31 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 32 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 33 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 34 | * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 35 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 36 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 37 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 39 | * |
| 40 | *******************************************************************************/ |
| 41 | #ifndef __COMMAND_H__ |
| 42 | #define __COMMAND_H__ |
| 43 | |
| 44 | /******************************************************************************/ |
| 45 | /********************** Macros and Constants Definitions **********************/ |
| 46 | /******************************************************************************/ |
| 47 | #define NULL ((void *)0) |
| 48 | #define SUCCESS 0 |
| 49 | #define ERROR -1 |
| 50 | |
| 51 | /******************************************************************************/ |
| 52 | /*************************** Types Declarations *******************************/ |
| 53 | /******************************************************************************/ |
| 54 | typedef void (*cmdFunction)(double* param, char paramNo); |
| 55 | |
| 56 | struct cmd_info { |
| 57 | char* name; |
| 58 | char* description; |
| 59 | char* acceptedValue; |
| 60 | char* example; |
| 61 | }; |
| 62 | /******************************************************************************/ |
| 63 | /************************ Functions Declarations ******************************/ |
| 64 | /******************************************************************************/ |
| 65 | |
| 66 | /* Initializes the device. */ |
| 67 | char DoDeviceInit(void); |
| 68 | |
| 69 | /* Displays all available commands. */ |
| 70 | void GetHelp(double* param, char paramNo); |
| 71 | |
| 72 | /* Resets the AD5781 device. */ |
| 73 | void DoReset(double* param, char paramNo); |
| 74 | |
| 75 | /* Writes to the DAC register. */ |
| 76 | void SetRegister(double* param, char paramNo); |
| 77 | |
| 78 | /* Displays last written value to the DAC register. */ |
| 79 | void GetRegister(double* param, char paramNo); |
| 80 | |
| 81 | /* Writes to the Offset Adjust register. */ |
| 82 | void SetOffset(double* param, char paramNo); |
| 83 | |
| 84 | /* Displays last written value to the Offset Adjust register. */ |
| 85 | void GetOffset(double* param, char paramNo); |
| 86 | |
| 87 | /* Writes to the Gain Adjust register. */ |
| 88 | void SetGain(double* param, char paramNo); |
| 89 | |
| 90 | /* Displays last written value to the Gain Adjust register. */ |
| 91 | void GetGain(double* param, char paramNo); |
| 92 | |
| 93 | /* Displays the die temperature. */ |
| 94 | void GetTemp(double* param, char paramNo); |
| 95 | |
| 96 | /* Displays the Vloop - COM voltage. */ |
| 97 | void GetVloop(double* param, char paramNo); |
| 98 | |
| 99 | /* Displays the Fault register. */ |
| 100 | void GetFaultReg(double* param, char paramNo); |
| 101 | |
| 102 | /* Displays the output current. */ |
| 103 | void GetCurrent(double* param, char paramNo); |
| 104 | |
| 105 | /* Sets the output current. */ |
| 106 | void SetCurrent(double* param, char paramNo); |
| 107 | |
| 108 | #endif // __COMMAND_H__ |