-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectConfig.h
More file actions
336 lines (274 loc) · 12.6 KB
/
ProjectConfig.h
File metadata and controls
336 lines (274 loc) · 12.6 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/**************************************************************************/
/*!
\file ProjectConfig.h
\author K. Townsend (microBuilder.eu)
\date 25 November 2009
\version 1.00
ProjectConfig.h contains various definitions and enumerations that
determine how the project works. By keeping this config information
in one central location it will often be easier to adjust the
behaviour of your program, rather than having to search through
dozens or hundreds of files to enable or disable different flags
or find the name of a task handler, etc.
*/
/**************************************************************************/
#ifndef PROJECT_CONFIG_H
#define PROJECT_CONFIG_H
// Included Peripherals
// ====================
// In order to make the code more portable, you can disable
// certain peripherals that may not be available on all
// devices (for example, RTC isn't available on certain chips)
#define CFG_RTC
#define CFG_ADC
#define CFG_FATFS
// Included Drivers
// ================
// You can comment out these definitions to remove any unused
// drivers from your compiled code, saving space and reducing
// any risk of errors
#define CFG_LCD 0
//#define CFG_TCS3414
//#define CFG_TPS851
// General Project Settings
// ========================
/**************************************************************************/
/*!
General project settings
*/
/**************************************************************************/
#define CFG_PROJECT_NAME (portCHAR *) "Olimex LPC-P2148 Anemometer" // The name of this project if you wish to display it
#define CFG_PROJECT_VERSION_MAJOR 1 // The 'major' version of this project
#define CFG_PROJECT_VERSION_MINOR 0 // The 'minor' version of this project
#define CFG_PROJECT_COPYRIGHT (portCHAR *) "(C) luki 2010-2011" // The copyright notice for this project if you wish to display it
//#define configGENERATE_RUN_TIME_STATS 0 // Timer 1 is used as counter for the windvelocity measurement
/**************************************************************************/
/*!
DataLogger settings
- How many Temperatures(Voltages) on which Portpin and settings
- Flowrate settings
- Log interval time
*/
/**************************************************************************/
#define CFG_DATALOGGER
#define CFG_LOGDATA
/* log summary */
//#define logCDaySummary
//#define logAllTimeSummary
#ifndef logCDaySummary
#undef logAllTimeSummary
#endif
#ifdef CFG_LOGDATA
#define LOG2FATFS // Log into File on SD
#define LOG2MONITOR // Log continuosly to monitor (uart0/usb/[lan])
/*! available Ports WITH special functions available and how are they used at Olimex's LPC-P2148 Evaluation Board.
It would be possible using just AD0 with the advantage of power reduction, nevertheless I use both (AD0 and AD1) considering leave AOUT free for future uses
-P0.0 TXD0 PWM1 GPIO (NOT yet used, perhabs for extern multiple ADC)
-P0.1 RXD0 PWM3 EINT0 (NOT yet used, perhabs for extern multiple ADC)
-P0.2 SCL0 CAP0.0 GPIO (NOT YET USED)
-P0.3 SDA0 MAT0.0 EINT1 Pumpenstellsignal detektieren
-P0.7 SSEL0 PWM2 EINT2 GPIO* SLEEP_RQ for XBee Modul
-P0.8 TXD1* PWM4 AD1.1 UART1 for XBee
-P0.9 RXD1* PWM6 EINT3 UART1 for XBee
-P0.21 AD1.6 CAP13* PWM Windspeed
-P0.22 AD1.7 CAP0.0 MAT0.0 (NOT YET USED)
-P0.25 AD0.4 AOUT (NOT YET USED)
-P0.28 AD0.1* CAP0.2 MAT0.2 (NOT YET USED)
-P0.29 AD0.2* CAP0.3 MAT0.3 (NOT YET USED)
-P0.30 AD0.3 EINT3 CAP0.0 (NOT YET USED)
-P1.16 PIPESTAT GPIO* LCD Pin 16 Reset GPIO1_FIOPIN2,Bit0
-P1.17 PIPESTAT GPIO* LCD Pin 14 Data7 GPIO1_FIOPIN2,Bit1
-P1.18 PIPESTAT GPIO* LCD Pin 13 Data6 GPIO1_FIOPIN2,Bit2
-P1.19 PIPESTAT GPIO* LCD Pin 12 Data5 GPIO1_FIOPIN2,Bit3
-P1.20 PIPESTAT GPIO* LCD Pin 11 Data4 GPIO1_FIOPIN2,Bit4
-P1.21 PIPESTAT GPIO* LCD Pin 6 E1 GPIO1_FIOPIN2,Bit5
-P1.22 PIPESTAT GPIO* LCD Pin 5 R/W GPIO1_FIOPIN2,Bit6
-P1.23 PIPESTAT GPIO* LCD Pin 16 RS/CS GPIO1_FIOPIN2,Bit7
*/
/*<! conversion from adcRead...() to Millivolt */
#define AREF 3300 /* ARef is 3300mV */
#define ADSPAN 1024 /* 10Bit conversion*/
#define get_AD_mV(intval) (AREF/ADSPAN*intval)
/*<! Winddirection/AD values to log
- Winddirection: -[0-360°]
- Winddirection Offset [°]
*/
static short windDirectionOffset = 0;
// P029
#define adcWindDirectionPwrRead adcRead0_1
#define adcWindDirectionPwrInit adcInit0_1
// P028 - 6Bit Auflösung -> 360°/(2^6)=5.625° Winkelauflösung
#define adcWindDirectionRead adcRead0_2
//#define adcWindDirectionInit adcInit0_2
#define adcWindDirectionInit adcInit0_2_6bit
// calculate windspeed out of frequency
#define windSpeedFromFrequency(windfrequency) ((short)(1/1.8112*windfrequency+0.7572))
/* Winddirection Sensor:
* A LM334Z run by a 120Ohm/1% resistor delivers a constant current of Iset=67.7mV/Rset=67.7mV/120Ohm=564uA
*
* circuit:
*
Vcc +3.3V
|
|
v
o---------------------o meas_op_item[2]
|
|
| (rot)
.-.
| |_____o meas_op_item[0] Sensor [3,4]kOhm;
| |
'-'
|(weiss)
|
'---------------------o GND ADC
|
===
GND
*
*/
// if a allTimeSummary shall be generated
//#define logAllTimeSummary
enum _LOG_ITEM_STATE {
OFF=0,
INIT,
IDLE,
START,
WAITING,
SAVEVALUE
} LOG_ITEM_STATE;
// #ifdef LOG_FLOWRATE
// #endif
#endif
/**************************************************************************/
/*!
I2C settings
*/
/**************************************************************************/
#define CFG_I2C_DEFAULT_TIMEOUT 100 // Default timeout, in milliseconds for generic read/write
#define CFG_I2C_DEBUG 1 // Whether I2C debug information (i2CDump) is available or not
/**************************************************************************/
/*!
Whether the LED "blinky" task should be started after reset/boot
*/
/**************************************************************************/
#define CFG_LED_RUNLEDONSTARTUP 1 // Run the led task on startup (to confirm board is OK)
#define CFG_PLAY_STARTUP 0
/**************************************************************************/
/*!
Configuration settings for Chibi 802.15.4 wireless stack
*/
/**************************************************************************/
// #define CFG_CHIBI
// #define CFG_CHB_DEBUG
#define CFG_XBEE
/**************************************************************************/
/*!
Configuration settings for FATFS and SD Cards
*/
/**************************************************************************/
#define CFG_FATFS
/**************************************************************************/
/*!
Configuration settings for uIP
*/
/**************************************************************************/
//LUK #define CFG_UIP // Enable uIP w/ ENC28J60 on SPI0
//LUK #define CFG_TELNETD // Enable telnet server under uIP
//LUK #define CFG_HTTPD // Enable http server under uIP
//LUK #define CFG_SNTP // Enable sntp client under uIP
//LUK #define CFG_DHCP // Enable DHCP under uIP
//LUK #define CFG_AUTO_UIP // Automatically start uIP at reboot (ignored if not CFG_UIP)
//LUK #define CFG_AUTO_DHCP // Automatically to DHCP for an address at start (ignored if not CFG_UIP, CFG_DHCP and CFG_AUTO_UIP)
//LUK #define CFG_AUTO_SNTP // Automatically to set the time via SNTP (ignored if not CFG_UIP and CFG_AUTO_UIP)
// No UIP means no servers and no auto stuff
#ifndef CFG_UIP
#undef CFG_TELNETD
#undef CFG_HTTPD
#undef CFG_SNTP
#undef CFG_DHCP
#undef CFG_AUTO_UIP
#undef CFG_AUTO_DHCP
#undef CFG_AUTO_SNTP
#endif
// Can't auto DHCP unless there's DHCP support, and auto requested
#if !defined CFG_DHCP || !defined CFG_AUTO_UIP
#undef CFG_AUTO_DHCP
#endif
// We need an lvalue to pass to uipStart() to DHCP or not
#ifdef CFG_AUTO_DHCP
#define CFG_AUTO_DHCP_VALUE 1
#else
#define CFG_AUTO_DHCP_VALUE 0
#endif
/**************************************************************************/
/*!
Monitor settings
CFG_MONITOR_UART0 should be defined if you wish to use UART0 for the
monitor, or CFG_MONITOR_USBSER if you wish to use USB Serial (CDC).
Please note that only one of CFG_MONITOR_UART0 or CFG_MONITOR_USBSER can be
defined at a time! By default both operate at 9600 Baud 8N1.
*/
/**************************************************************************/
#define CFG_MONITOR_UART0 // Use UART0 for the monitor console
//#define CFG_MONITOR_USBSER // Use USB Serial for the monitor console
#define CFG_MONITOR_PROMPT "Command > " // The 'command prompt' that will be displayed in the monitor
#define CFG_MONITOR_ALLOWRESET 1 // Whether the user is allowed to issue the reset command
#define CFG_MONITOR_ALLOWI2C 1 // Whether the user is allowed to send generic I2C commands
#define CFG_MONITOR_ALLOWSPI 1 // Whether the user is allowed to send generic SPI commands
// Config Error Checking
// =====================
// Make sure that an input/output device is defined for monitor
#if !defined CFG_MONITOR_UART0 && !defined CFG_MONITOR_USBSER
#error "You must define a monitor output: CFG_MONITOR_UART0 or CFG_MONITOR_USBSER"
#endif
// Make sure that only ONE device is defined for monitor
#if defined CFG_MONITOR_UART0 && defined CFG_MONITOR_USBSER
#error "You can only define one of: CFG_MONITOR_UART0 or CFG_MONITOR_USBSER"
#endif
/**************************************************************************/
/*!
An enumeration of every xTaskHandle used for FreeRTOS 'tasks'.
By defining the task handle here you can easily access any task
without having to remember or look up the xTaskHandle name in
dozens of different files.
When creating a new task, you simply need to add a new task handle to
this enumeration (anywhere before TASKHANDLE_LAST), and then reference
the entry when you actually create your task, as in the example below:
\code
// Create a 'startup' task (assumes 'TASKHANDLE_STARTUP' is defined)
xTaskCreate (vStartupTask,
(const signed portCHAR * const)"Startup",
configMINIMAL_STACK_SIZE,
NULL,
configMAX_PRIORITIES,
&taskHandles[TASKHANDLE_STARTUP]);
\endcode
*/
/**************************************************************************/
typedef enum
{
TASKHANDLE_STARTUP,
TASKHANDLE_MONITOR,
TASKHANDLE_LED,
//LUK TASKHANDLE_TCS3414,
//LUK TASKHANDLE_TPS851,
// TASKHANDLE_POTI,
// TASKHANDLE_SETTIME,
// TASKHANDLE_UIP,
//#if CFG_LCD == 1
TASKHANDLE_LCD,
//#endif
TASKHANDLE_TRACKLOG,
TASKHANDLE_MEASTASK,
TASKHANDLE_MEASSM,
// TASKHANDLE_LOGGING,
#if configGENERATE_RUN_TIME_STATS == 1
TASKHANDLE_RUNTIMESTATS,
#endif
TASKHANDLE_LAST
}
taskHandle_e;
void * taskHandles [TASKHANDLE_LAST];
#endif