Github
Github Wiki
Project Page
Firmware for an ad-hoc mesh network of Internet-of-Things devices based on LoRa (Long Range radio) that can be deployed quickly and cheaply.
cdpcfg.h
Go to the documentation of this file.
1
22
// preload optional pre-cfg
23
#ifndef CRPCFG_PRE
24
#define CRPCFG_PRE
25
#if __has_include("cdpcfg-pre.h")
26
#include "cdpcfg-pre.h"
27
#endif
28
#endif
29
30
// this is the actual main configuration section
31
#ifndef CDPCFG
32
#define CDPCFG
33
34
/*
35
* HARDWARE SECTION // BOARD PINS
36
* the ARDUINO_* defs are set by the arduino build env
37
*/
38
47
#if defined(ARDUINO_TTGO_LoRa32_V1)
48
49
#define CDPCFG_PIN_LED1 25
50
51
// Lora configurations
52
#define CDPCFG_PIN_LORA_CS 18
53
#define CDPCFG_PIN_LORA_DIO0 26
54
#define CDPCFG_PIN_LORA_RST 23
55
56
// Oled Display settings
57
// #define CDPCFG_PIN_OLED_ROTATION U8G2_R0
58
#define CDPCFG_PIN_OLED_CLOCK 15
59
#define CDPCFG_PIN_OLED_DATA 4
60
#define CDPCFG_PIN_OLED_RESET 16
61
62
// actualy missing
63
#define CDPCFG_PIN_LORA_DIO1 -1
64
72
#elif defined(ARDUINO_TTGO_LoRa32_V2)
73
74
#define CDPCFG_PIN_BAT 35
75
#define CDPCFG_BAT_MULDIV 200 / 100
76
77
#define CDPCFG_PIN_LED1 25
78
79
// Lora configurations
80
#define CDPCFG_PIN_LORA_CS 18
81
#define CDPCFG_PIN_LORA_DIO0 26
82
#define CDPCFG_PIN_LORA_RST 14
83
84
// Oled Display settings
85
86
#define CDPCFG_PIN_OLED_CLOCK 15
87
#define CDPCFG_PIN_OLED_DATA 4
88
#define CDPCFG_PIN_OLED_RESET 16
89
#define CDPCFG_PIN_OLED_ROTATION U8G2_R0
90
91
// actualy missing
92
#define CDPCFG_PIN_LORA_DIO1 -1
93
94
// T-Beam
95
#elif defined(ARDUINO_TBeam)
96
#define CDPCFG_PIN_BAT 35
97
#define CDPCFG_BAT_MULDIV 200 / 100
98
#define CDPCFG_PIN_LED1 25
99
// Lora configurations
100
#define CDPCFG_PIN_LORA_CS 18
101
#define CDPCFG_PIN_LORA_DIO0 26
102
#define CDPCFG_PIN_LORA_RST 14
103
// Oled Display settings
104
#define CDPCFG_PIN_OLED_CLOCK 22
105
#define CDPCFG_PIN_OLED_DATA 21
106
#define CDPCFG_PIN_OLED_RESET 16
107
#define CDPCFG_PIN_OLED_ROTATION U8G2_R0
108
// actualy missing
109
#define CDPCFG_PIN_LORA_DIO1 -1
110
111
112
113
/*
114
* BOARD "heltec wireless stick"
115
* http://www.heltec.cn/project/wireless-stick/
116
* pio: board = heltec_wireless_stick
117
*/
118
#elif defined(ARDUINO_HELTEC_WIRELESS_STICK)
119
120
#define CDPCFG_PIN_BAT 37
121
#define CDPCFG_BAT_MULDIV 320 / 100
122
123
#define CDPCFG_PIN_VEXT 21
124
125
#define CDPCFG_PIN_LED1 25
126
127
// Lora configurations
128
#define CDPCFG_PIN_LORA_CS 18
129
#define CDPCFG_PIN_LORA_DIO0 26
130
#define CDPCFG_PIN_LORA_RST 14
131
132
// Oled Display settings
133
#define CDPCFG_OLED_64x32
134
#define CDPCFG_PIN_OLED_CLOCK 15
135
#define CDPCFG_PIN_OLED_DATA 4
136
#define CDPCFG_PIN_OLED_RESET 16
137
138
// actualy missing
139
#define CDPCFG_PIN_LORA_DIO1 -1
140
141
/*
142
* BOARD "heltec wireless stick lite"
143
* ARDUIONO BOARD PACKAGE URL:
144
* https://resource.heltec.cn/download/package_heltec_esp32_index.json
145
* DOCS:
146
* http://www.heltec.cn/project/wireless-stick-lite/
147
* pio: board = WIRELESS_STICK_LITE
148
*/
149
#elif defined(ARDUINO_WIRELESS_STICK_LITE)
150
151
#define CDPCFG_PIN_BAT 37
152
#define CDPCFG_BAT_MULDIV 320 / 100
153
154
#define CDPCFG_PIN_VEXT 21
155
156
#define CDPCFG_PIN_LED1 25
157
158
// Lora configurations
159
#define CDPCFG_PIN_LORA_CS 18
160
#define CDPCFG_PIN_LORA_DIO0 26
161
#define CDPCFG_PIN_LORA_RST 14
162
163
// Oled Display settings
164
#define CDPCFG_OLED_NONE
165
166
// actualy missing
167
#define CDPCFG_PIN_LORA_DIO1 -1
168
169
/*
170
* BOARD "rocket scream Mini Ultra Pro v3"
171
* https://www.rocketscream.com/blog/docs-item/mini-ultra-pro-hookup-guide/
172
* pio: board = arduino_zero
173
*/
174
#elif defined(ARDUINO_SAMD_ZERO)
175
// This is not an official ARDUINO_* but uses the same bootloader
176
// as the SAMD21 based Arduino Zero
177
//
178
// Lora configurations (HopeRF RFM95W chip)
179
#define CDPCFG_PIN_LORA_CS 5
180
#define CDPCFG_PIN_LORA_DIO0 2
181
#define CDPCFG_PIN_LORA_DIO1 6
182
#define CDPCFG_PIN_LORA_DIO2 -1 // Unused
183
#define CDPCFG_PIN_LORA_RST 3
184
185
// Oled Display settings
186
#define CDPCFG_OLED_NONE
187
188
// Wifi module
189
#define CDPCFG_WIFI_NONE
190
191
// Required for Serial on Zero based boards
192
#define Serial SERIAL_PORT_USBVIRTUAL
193
//===== BOARD "rocket scream Mini Ultra Pro v3" =====
194
195
/*
196
* BOARD "sparkfun lora gateway 1-channel"
197
* https://www.sparkfun.com/products/15006
198
* pio: board = sparkfun_lora_gateway_1-channel
199
*/
200
#elif defined(SPARKFUN_LGW1C)
201
// this is not an official ARDUINO_* define since this board doesnt have one
202
203
// Lora configurations
204
#define CDPCFG_PIN_LORA_CS 16
205
#define CDPCFG_PIN_LORA_DIO0 26
206
#define CDPCFG_PIN_LORA_DIO1 33
207
#define CDPCFG_PIN_LORA_DIO2 32
208
#define CDPCFG_PIN_LORA_RST 5
209
210
// Oled Display settings
211
#define CDPCFG_OLED_NONE
212
213
/*
214
* BOARD "pycom lopy"
215
* https://docs.pycom.io/datasheets/development/lopy/
216
* pio: board = lopy
217
*/
218
#elif defined(ARDUINO_LoPy)
219
220
#define CDPCFG_PIN_ANT 16
221
222
// Lora configurations
223
#define CDPCFG_PIN_LORA_CS 17
224
#define CDPCFG_PIN_LORA_DIO0 23
225
#define CDPCFG_PIN_LORA_RST 18
226
227
// special SPI
228
#define CDPCFG_PIN_LORA_SPI_SCK 5
229
#define CDPCFG_PIN_LORA_SPI_MISO 19
230
#define CDPCFG_PIN_LORA_SPI_MOSI 27
231
#define CDPCFG_LORA_CLASS SX1272
232
233
// Oled Display settings
234
#define CDPCFG_OLED_NONE
235
236
// actualy missing
237
#define CDPCFG_PIN_LORA_DIO1 -1
238
239
/*
240
* BOARD "pycom lopy4"
241
* https://docs.pycom.io/datasheets/development/lopy4/
242
* pio: board = lopy4
243
*/
244
#elif defined(ARDUINO_LoPy4)
245
246
#define CDPCFG_PIN_ANT 16
247
248
// Lora configurations
249
#define CDPCFG_PIN_LORA_CS 18
250
#define CDPCFG_PIN_LORA_DIO0 23
251
#define CDPCFG_PIN_LORA_RST -1
252
253
// special SPI
254
#define CDPCFG_PIN_LORA_SPI_SCK 5
255
#define CDPCFG_PIN_LORA_SPI_MISO 19
256
#define CDPCFG_PIN_LORA_SPI_MOSI 27
257
#define CDPCFG_LORA_CLASS SX1276
258
259
// Oled Display settings
260
#define CDPCFG_OLED_NONE
261
262
// actualy missing
263
#define CDPCFG_PIN_LORA_DIO1 -1
264
265
#else
266
267
#if !defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
268
#warning "NO BOARD DEFINED, DEFAULTING TO HELTEC v2"
269
#define CDPCFG_BOARD_DEFAULT
270
#endif
271
272
/*
273
* BOARD "heltec lora v2"
274
* https://heltec.org/project/wifi-lora-32/
275
* pio: board = heltec_wifi_lora_32_V2
276
*/
277
278
#define CDPCFG_PIN_BAT 37
279
#define CDPCFG_BAT_MULDIV 320 / 100
280
281
#define CDPCFG_PIN_VEXT 21
282
283
#define CDPCFG_PIN_LED1 25
284
285
// Lora configurations
286
#define CDPCFG_PIN_LORA_CS 18
287
#define CDPCFG_PIN_LORA_DIO0 26
288
#define CDPCFG_PIN_LORA_RST 14
289
290
// Oled Display settings
291
#define CDPCFG_PIN_OLED_CLOCK 15
292
#define CDPCFG_PIN_OLED_DATA 4
293
#define CDPCFG_PIN_OLED_RESET 16
294
#define CDPCFG_PIN_OLED_ROTATION U8G2_R0
295
296
// actualy missing
297
#define CDPCFG_PIN_LORA_DIO1 -1
298
299
#endif
300
306
// Username and Password for OTA web page
307
#define CDPCFG_UPDATE_USERNAME "username"
308
#define CDPCFG_UPDATE_PASSWORD "password"
309
311
#define CDPCFG_SERIAL_BAUD 115200
312
313
// Access point IP adress
314
315
#define CDPCFG_AP_IP1 192
316
#define CDPCFG_AP_IP2 168
317
#define CDPCFG_AP_IP3 1
318
#define CDPCFG_AP_IP4 1
319
321
#define CDPCFG_WEB_PORT 80
322
324
#define CDPCFG_RF_LORA_FREQ 915.0
325
#define CDPCFG_RF_LORA_BW 125.0
327
#define CDPCFG_RF_LORA_SF 7
329
#define CDPCFG_RF_LORA_TXPOW 20
331
#define CDPCFG_RF_LORA_GAIN 0
333
335
#define CDPCFG_CDP_BUFSIZE 256
336
#define CDPCFG_UUID_LEN 8
338
340
#define CDPCFG_MILLIS_ALIVE 1800000
341
#define CDPCFG_MILLIS_REBOOT 43200000
343
345
#define CDPCFG_PIN_RGBLED_R 25
346
#define CDPCFG_PIN_RGBLED_G 4
348
#define CDPCFG_PIN_RGBLED_B 2
350
351
#ifndef CDPCFG_LORA_CLASS
352
#define CDPCFG_LORA_CLASS SX1276
354
#endif
355
356
#ifndef CDPCFG_OLED_CLASS
357
#if defined(CDPCFG_OLED_NONE)
358
// do nothing
359
#elif defined(CDPCFG_OLED_64x32)
360
// smaller displays
361
#define CDPCFG_OLED_CLASS U8G2_SSD1306_64X32_NONAME_F_SW_I2C
362
#else
363
// classic default
364
#define CDPCFG_OLED_CLASS U8G2_SSD1306_128X64_NONAME_F_SW_I2C
365
#endif
366
#endif
367
368
#endif // CDPCFG
369
370
// append optional post-cfg
371
#ifndef CRPCFG_POST
372
#define CRPCFG_POST
373
#if __has_include("cdpcfg-post.h")
374
#include "cdpcfg-post.h"
375
#endif
376
#endif
src
include
cdpcfg.h
Wiki
GitHub
Project Page