-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.h
More file actions
155 lines (138 loc) · 3.55 KB
/
main.h
File metadata and controls
155 lines (138 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//=========================================================================
// main.h
//
// An interface for the RM3100 3-axis magnetometer from PNI Sensor Corp.
// Derived in part from several sources:
//
// Author: David M. Witten II, KD0EAG
// Date: Jan 30, 2021
// Date: Jan 31, 2021
// Date: Jun 16, 2021
// Date: Jul 16, 2021
// Date: Aug 27, 2021
// License: GPL 3.0
//=========================================================================
#ifndef MULTIMAGMAIN_h
#define MULTIMAGMAIN_h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <semaphore.h>
#include <pthread.h>
#include "rm3100.h"
#include "mcp9808.h"
//#include "logFiles.h"
#include "utilRoutines.h"
//#include "sensorRoutines.h"
#include "uthash/uthash.h"
//------------------------------------------
// Options while building & testing
//------------------------------------------
#define USE_SEMAPHORE 1
#define READ_I2C 0
#define USE_PIPES TRUE
//------------------------------------------
// Important constants
//------------------------------------------
#define MAXKEYLEN 64
#define MAXVALLEN 64
#define MAXVERSIONLEN 30
#define MULTIMAG_VERSION "0.0.1"
#define MAXTHREADS 10
#define UTCBUFLEN 64
#define MAXPATHBUFLEN 1500
#define FOLDERNAMELEN 1500
#define SITEPREFIXLEN 32
#define GRIDSQRLEN 7
#define NOT_USED -1
//------------------------------------------
// struct pStruct
//------------------------------------------
struct pStruct
{
int id; /* key */
char key[MAXKEYLEN];
char val[MAXVALLEN];
UT_hash_handle hh; /* makes this structure hashable */
};
//------------------------------------------
// types
//------------------------------------------
typedef struct tag_pList
{
// from runMag - investigate
int magnetometerAddr;
int localTempAddr;
int remoteTempAddr;
int magRevId;
// flags to be considered
int modeOutputFlag; // ?
int doBistMask; // ?
int tsMilliseconds; // ?
int showTotal; // ?
// multiMag from here on...
int printParamFlg;
int numThreads;
int threadOffsetUS;
int threadCadenceUS;
int i2cBusNumber;
int i2c_fd;
FILE *outfp;
FILE *infp;
int fdPipeIn;
int fdPipeOut;
int outDelay;
int showParameters;
int singleRead;
int logOutput;
int useOutputPipe;
int usePPS;
int useI2CMUX;
int i2cMUXAddr;
int TMRCRate;
int CMMSampleRate;
int samplingMode;
int NOSRegValue;
int cc_x;
int cc_y;
int cc_z;
int x_gain;
int y_gain;
int z_gain;
int writeWorkingCFG;
char *city;
char *state;
char *country;
char *postalcode;
char *gridSqr;
char *lattitude;
char *longitude;
char *elevation;
char *sitePrefix;
char *logOutputTime;
char *Version;
char *rollOverTime;
char *baseFilePath;
char *outputFilePath;
char *outputFileName;
char *pipeInPath;
char *pipeOutPath;
char *system;
struct pStruct **jsParams;
} pList;
//------------------------------------------
// prototypes
//------------------------------------------
int main(int argc, char** argv);
void *i2cReader(void *thread_id);
int setupDefaults(pList *p);
#endif // MULTIMAGMAIN_h