| 1 | /**************************************************************************//** |
| 2 | * @file command.h |
| 3 | * @brief Command header file |
| 4 | * @author Istvan Csomortani ([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 modification, |
| 12 | * 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 IMPLIED |
| 30 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY |
| 31 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 32 | * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 34 | * INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 35 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 36 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 38 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 39 | * |
| 40 | ******************************************************************************* |
| 41 | * SVN Revision: 2044 |
| 42 | ******************************************************************************/ |
| 43 | |
| 44 | #ifndef __COMMAND__H__ |
| 45 | #define __COMMAND__H__ |
| 46 | |
| 47 | /******************************************************************************/ |
| 48 | /********************** Macros and Constants Definitions **********************/ |
| 49 | /******************************************************************************/ |
| 50 | #define NULL ((void *)0) |
| 51 | #define SUCCESS 0 |
| 52 | #define ERROR -1 |
| 53 | |
| 54 | /******************************************************************************/ |
| 55 | /*************************** Types Declarations *******************************/ |
| 56 | /******************************************************************************/ |
| 57 | typedef void (*cmdFunction)(double* param, char paramNo); |
| 58 | |
| 59 | struct cmd_info { |
| 60 | char* name; |
| 61 | char* description; |
| 62 | char* acceptedValue; |
| 63 | char* example; |
| 64 | }; |
| 65 | |
| 66 | /***************************************************************************/ |
| 67 | /************************ Functions Definitions ****************************/ |
| 68 | /***************************************************************************/ |
| 69 | |
| 70 | void DisplayError(unsigned char funcNo); |
| 71 | void DisplayCmdList(); |
| 72 | void DoDeviceLock(void); |
| 73 | char DoDeviceInit(void); |
| 74 | |
| 75 | /* help? implementation - Print available commands*/ |
| 76 | void GetHelp(double* param, char paramNo); |
| 77 | /* dataReg= implementation - Set the value of a data registers*/ |
| 78 | void SetDataRegister(double* param, char paramNo); |
| 79 | /* controlReg= implementation - Set the value of a control registers*/ |
| 80 | void SetControlRegister(double* param, char paramNo); |
| 81 | /* register? implementation - Register ReadBack*/ |
| 82 | void GetRegister(double* param, char paramNo); |
| 83 | /* power= implementation - Set the power state of a specified channel */ |
| 84 | void SetPower(double* param, char paramNo); |
| 85 | /* power? implementation - Displays the power state of a specified channel */ |
| 86 | void GetPower(double* param, char paramNo); |
| 87 | /* range= command implementation - Displays the range of a specified channel */ |
| 88 | void SetRange(double* param, char paramNo); |
| 89 | /* range? command implementation - Displays the range of a specified channel */ |
| 90 | void GetRange(double* param, char paramNo); |
| 91 | /* voltage= implementation - Set the value of voltage */ |
| 92 | void SetVoltage(double* param, char paramNo); |
| 93 | /* voltage? implementation - Display the value of voltage*/ |
| 94 | void GetVoltage(double* param, char paramNo); |
| 95 | /* current= implementation - Set the value of current*/ |
| 96 | void SetCurrent(double* param, char paramNo); |
| 97 | /* current? implementation - Display the value of current */ |
| 98 | void GetCurrent(double* param, char paramNo); |
| 99 | /*! Read back the Status register and print any faults or errors.*/ |
| 100 | void EvaluateStatus(double* param, char paramNo); |
| 101 | /*! Ensure that the SPI pins are working correctly.*/ |
| 102 | void TestSpi(double* param, char paramNo); |
| 103 | |
| 104 | #endif |