forked from blynkkk/blynk-sketch-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_boards.js
298 lines (254 loc) · 7.03 KB
/
data_boards.js
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
'use strict';
const header_comment =
`/*************************************************************
<%= board.comment %>
<%= example.comment %>
*************************************************************/
`;
const ArduinoRegularTemplate = header_comment + `
// Template ID, Device Name and Auth Token are provided by the Blynk.Cloud
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID "<%= tmpl_id %>"
#define BLYNK_DEVICE_NAME "<%= dev_name %>"
#define BLYNK_AUTH_TOKEN "<%= auth %>"
// Comment this out to disable prints and save space
#define BLYNK_PRINT <%= serial_dbg %>
<%= board.defs %>
<%= example.defs %>
<%= board.inc %>
<%= example.inc %>
char auth[] = BLYNK_AUTH_TOKEN;
<%= board.glob %>
<%= example.glob %>
void setup()
{
// Debug console
<%= serial_dbg %>.begin(115200);
<%= board.init %>
<%= example.init %>
}
void loop()
{
<%= board.loop %>
Blynk.run();
<%= example.loop %>
}
`;
const RaspberryTemplate = header_comment + `
// Template ID and Device Name are provided by the Blynk.Cloud.
// See the Device Info tab, or Template settings
#define BLYNK_TEMPLATE_ID "<%= tmpl_id %>"
#define BLYNK_DEVICE_NAME "<%= dev_name %>"
// Comment this out to disable prints and save space
#define BLYNK_PRINT <%= serial_dbg %>
#ifdef RASPBERRY
#include <BlynkApiWiringPi.h>
#else
#include <BlynkApiLinux.h>
#endif
#include <BlynkSocket.h>
#include <BlynkOptionsParser.h>
<%= example.inc %>
static BlynkTransportSocket _blynkTransport;
BlynkSocket Blynk(_blynkTransport);
#include <BlynkWidgets.h>
<%= example.glob %>
void setup()
{
<%= example.init %>
}
void loop()
{
Blynk.run();
<%= example.loop %>
}
int main(int argc, char* argv[])
{
const char *auth, *serv;
uint16_t port;
parse_options(argc, argv, auth, serv, port);
Blynk.begin(auth, serv, port);
setup();
while(true) {
loop();
}
return 0;
}
`;
const Raspberry = {
template: RaspberryTemplate,
serial_dbg: "stdout",
};
const ArduinoRegular = {
template: ArduinoRegularTemplate,
serial_dbg: "Serial",
exclude: [/Serial1/]
};
const ArduinoUSB = {
template: ArduinoRegularTemplate,
serial_dbg: "SerialUSB",
serial_dat: "Serial",
};
const ArduinoSerial1 = {
template: ArduinoRegularTemplate,
serial_dbg: "Serial",
serial_dat: "Serial1"
};
const boards = {
/***********************************************/
"--- Espressif" : {},
/***********************************************/
"ESP8266" : {
builtin: ["ESP8266 WiFi", "ESP8266 WiFi (SSL)"],
exclude: [/.*/]
},
"ESP32" : {
builtin: ["ESP32 WiFi", "ESP32 WiFi (SSL)"], // TODO: "BLE"
exclude: [/.*/]
},
"NodeMCU" : { inherit: "ESP8266" },
"WeMos D1" : { inherit: "ESP8266" },
"Adafruit Huzzah" : { inherit: "ESP8266" },
"SparkFun Blynk Board" : { inherit: "ESP8266" },
"SparkFun ESP8266 Thing" : { inherit: "ESP8266" },
/***********************************************/
"--- Seeed Studio" : {},
/***********************************************/
"Wio Terminal" : {
builtin: ["rpcWiFi", "rpcWiFi (SSL)"],
exclude: [/.*/]
},
/***********************************************/
"--- Linux (C++)" : {},
/***********************************************/
"Raspberry Pi" : {
exclude: [/.*/],
builtin: ["System default"],
inherit: Raspberry
},
"Ubuntu" : {
inherit: "Raspberry Pi"
},
/***********************************************/
"--- Arduino" : {},
/***********************************************/
"Arduino Uno" : {
},
"Arduino MKR1000" :
{
inherit: "Arduino Zero",
builtin: ["Arduino WiFi Shield 101"],
exclude: [/Serial/, /Ethernet/, /WiFly/, /CC3000/]
},
"Arduino MKRZero" : { inherit: "Arduino MKR1000" },
"Arduino Yun" : {
builtin: ["Yun Bridge"],
exclude: [/.*/]
},
"Arduino 101" : {
builtin: ["Arduino 101 BLE"],
exclude: [/nRF/, /HC/, /Bluefruit/]
},
"Arduino Zero" : {
inherit: ArduinoUSB
},
"Arduino M0" : { inherit: "Arduino Zero" },
"Arduino M0 Pro" : { inherit: "Arduino Zero" },
"Arduino Nano" : {
exclude: [/Ethernet/, /WiFi/],
inherit: "Arduino Uno"
},
"Arduino Leonardo" : {
inherit: ArduinoSerial1
},
"Arduino Due" : {
},
"Arduino Mega 2560" : {
exclude: [/SoftwareSerial/],
inherit: ArduinoSerial1
},
"Arduino Mega 1280" : { inherit: "Arduino Mega 2560" },
"Arduino Mega ADK" : { inherit: "Arduino Mega 2560" },
"Arduino Micro" : { inherit: "Arduino Leonardo" },
"Arduino Pro Micro" : { inherit: "Arduino Leonardo",
exclude: [/Ethernet/, /WiFi/] },
"Arduino Mini" : { inherit: "Arduino Nano" },
"Arduino Pro Mini" : { inherit: "Arduino Nano" },
"Arduino Fio" : { inherit: "Arduino Nano" },
"Arduino Diecimila" : { inherit: "Arduino Uno" },
"Arduino Duemilanove" : { inherit: "Arduino Uno" },
"Arduino Pro" : { inherit: "Arduino Uno" },
"Arduino Ethernet" : { inherit: "Arduino Uno", builtin: ["Ethernet Shield W5100"] },
"Arduino Leonardo ETH" : { inherit: "Arduino Leonardo", builtin: ["Ethernet Shield W5500"] },
"Arduino Industrial 101" : { inherit: "Arduino Yun" },
/***********************************************/
"--- Particle" : {},
/***********************************************/
"Particle Core" : {
inherit: "Particle Photon"
},
"Particle Photon" : {
builtin: ["Particle WiFi"],
exclude: [/.*/]
},
"Particle Electron" : {
builtin: ["Particle Cellular"],
exclude: [/.*/]
}
//"Bluz" : {
// builtin: ["BLE"],
// exclude: [/.*/],
//},
};
const later = {
/***********************************************/
"--- Intel" : {},
/***********************************************/
"Intel Edison" : {
builtin: ["WiFi"]
},
"Intel Galileo" : {
builtin: ["Ethernet"]
},
"Intel Curie" : {
inherit: "Arduino 101"
},
"Intel Joule" : {
builtin: ["WiFi", "Ethernet"]
},
/***********************************************/
"--- RedBear" : {},
/***********************************************/
"RedBear Duo" : {
builtin: ["WiFi", "BLE"]
},
"RedBear BLE Nano" : {
builtin: ["BLE"]
},
"RedBear Blend" : {
builtin: ["BLE"]
},
"RedBear Blend Micro" : { inherit: "RedBear Blend" },
/***********************************************/
"--- Other" : {},
/***********************************************/
"BBC micro:bit" : {
builtin: ["BLE"]
},
"RFDuino BLE" : {
builtin: ["BLE"]
},
"Simblee BLE" : {
builtin: ["BLE"]
}
/***********************************************/
//"TinyDuino" : { inherit: "Arduino Uno", exclude: [/.*/] },
//"ATtiny85" : { exclude: [/.*/] },
/***********************************************/
};
Object.keys(boards).forEach((k) => {
if (boards[k].inherit === undefined) {
boards[k] = Object.assign({}, ArduinoRegular, boards[k]);
}
});
module.exports = boards;