Mercurial > hg > fxanalyse
changeset 164:211ea3950310
Read AD9956 configuration from configuration file
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Mon, 10 Feb 2014 15:19:34 +0100 |
parents | 4ff3e468ab5f |
children | 05daf9593946 |
files | FXAnalyse.c FXAnalyse.ini |
diffstat | 2 files changed, 46 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/FXAnalyse.c Mon Feb 10 15:19:29 2014 +0100 +++ b/FXAnalyse.c Mon Feb 10 15:19:34 2014 +0100 @@ -17,6 +17,7 @@ #include "stat.h" #include "data-provider.h" +#define CONFIGFILE "FXAnalyse.ini" #define SR_LOGGER_IP "145.238.204.91" #define DATAFOLDER "Z:\\Measures-2014" @@ -422,12 +423,15 @@ } + + void CVICALLBACK DataAvailableCB (CmtTSQHandle queueHandle, unsigned int event, int value, void *callbackData); int main (int argc, char *argv[]) { + int rv; double frequency; char expr[1024]; @@ -442,6 +446,36 @@ return -1; if ((LoggingPanel = LoadPanel (0, "FXAnalyse.uir", LOGGING)) < 0) return -1; + + // construct configuration file path + char pathname[MAX_PATHNAME_LEN]; + char project[MAX_PATHNAME_LEN]; + GetProjectDir(project); + MakePathname(project, CONFIGFILE, pathname); + + // load configuration file */ + IniText configuration = Ini_New(TRUE); + Ini_ReadFromFile(configuration, pathname); + + // get AD9956 configuration parameters + char host[256]; + int port; + double clock; + rv = Ini_StringIntoBuffer(configuration, "AD9956", "host", host, sizeof(host)); + if (! rv) + return -1; + rv = Ini_GetInt(configuration, "AD9956", "port", &port); + if (! rv) + return -1; + rv = Ini_GetDouble(configuration, "AD9956", "clock", &clock); + if (! rv) + return -1; + + // initialyze 1x AD9956 DDS box + DDSFox_Initialize(&DDS1xAD9956, host, port, dedrift.freq0); + + // free + Ini_Dispose(configuration); // initialize 4x AD9959 DDS box DDS4xAD9912_Reset(&DDS4xAD9912); @@ -454,9 +488,6 @@ GetCtrlVal(MainPanel, PANEL_DDS4, &frequency); DDS4xAD9912_SetFrequency(&DDS4xAD9912, 4, frequency); - // initialyze 1x AD9956 DDS box - DDSFox_Initialize(&DDS1xAD9956, "145.238.205.58", 6665, dedrift.freq0); - GetCtrlVal(MainPanel, PANEL_N1CHOICE, &N1); GetCtrlVal(MainPanel, PANEL_N2CHOICE, &N2); GetCtrlVal(MainPanel, PANEL_N3CHOICE, &N3);