grblHAL core
20241107
driver_opts.h
Go to the documentation of this file.
1
/*
2
driver_opts.h - for preprocessing options from my_machine.h or compiler symbols
3
4
NOTE: This file is not used by the core, it may be used by drivers
5
6
Part of grblHAL
7
8
Copyright (c) 2020-2024 Terje Io
9
10
grblHAL is free software: you can redistribute it and/or modify
11
it under the terms of the GNU General Public License as published by
12
the Free Software Foundation, either version 3 of the License, or
13
(at your option) any later version.
14
15
grblHAL is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU General Public License for more details.
19
20
You should have received a copy of the GNU General Public License
21
along with grblHAL. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
24
//
25
// NOTE: do NOT change options here - edit the driver specific my_machine.h instead!
26
//
27
28
#pragma once
29
30
#include "
hal.h
"
31
#include "
nuts_bolts.h
"
32
33
#ifndef X_GANGED
34
#define X_GANGED 0
35
#endif
36
#ifndef X_AUTO_SQUARE
37
#define X_AUTO_SQUARE 0
38
#endif
39
#ifndef Y_GANGED
40
#define Y_GANGED 0
41
#endif
42
#ifndef Y_AUTO_SQUARE
43
#define Y_AUTO_SQUARE 0
44
#endif
45
#ifndef Z_GANGED
46
#define Z_GANGED 0
47
#endif
48
#ifndef Z_AUTO_SQUARE
49
#define Z_AUTO_SQUARE 0
50
#endif
51
#ifndef X_GANGED_LIM_MAX
52
#define X_GANGED_LIM_MAX 0
53
#endif
54
#ifndef Y_GANGED_LIM_MAX
55
#define Y_GANGED_LIM_MAX 0
56
#endif
57
#ifndef Z_GANGED_LIM_MAX
58
#define Z_GANGED_LIM_MAX 0
59
#endif
60
61
#if X_AUTO_SQUARE && !X_GANGED
62
#undef X_GANGED
63
#define X_GANGED 1
64
#endif
65
#if Y_AUTO_SQUARE && !Y_GANGED
66
#undef Y_GANGED
67
#define Y_GANGED 1
68
#endif
69
#if Z_AUTO_SQUARE && !Z_GANGED
70
#undef Z_GANGED
71
#define Z_GANGED 1
72
#endif
73
74
#define N_GANGED (X_GANGED + Y_GANGED + Z_GANGED)
75
#define N_AUTO_SQUARED (X_AUTO_SQUARE + Y_AUTO_SQUARE + Z_AUTO_SQUARE)
76
#define N_ABC_MOTORS (N_ABC_AXIS + N_GANGED)
77
78
#ifndef PROBE_ENABLE
79
#define PROBE_ENABLE 1
80
#endif
81
82
#ifndef NEOPIXELS_ENABLE
83
#define NEOPIXELS_ENABLE 0
84
#endif
85
86
#ifndef USB_SERIAL_CDC
87
#define USB_SERIAL_CDC 0
// for UART comms
88
#endif
89
#ifndef USB_SERIAL_WAIT
90
#define USB_SERIAL_WAIT 0
91
#endif
92
93
#if USB_SERIAL_CDC == 0 && !defined(SERIAL_STREAM)
94
#define SERIAL_STREAM 0
95
#endif
96
97
#ifndef MACROS_ENABLE
98
#define MACROS_ENABLE 0
99
#endif
100
101
#ifndef KEYPAD_ENABLE
102
#define KEYPAD_ENABLE 0
103
#endif
104
105
#if KEYPAD_ENABLE == 1
106
#ifdef I2C_STROBE_ENABLE
107
#undef I2C_STROBE_ENABLE
108
#endif
109
#define I2C_STROBE_ENABLE 1
110
#elif KEYPAD_ENABLE == 2 && !defined(KEYPAD_STREAM)
111
#if USB_SERIAL_CDC
112
#define KEYPAD_STREAM 0
113
#else
114
#define KEYPAD_STREAM 1
115
#endif
116
#endif
117
118
#ifndef I2C_STROBE_ENABLE
119
#define I2C_STROBE_ENABLE 0
120
#endif
121
122
#ifndef MPG_ENABLE
123
#define MPG_ENABLE 0
124
#endif
125
126
#if MPG_ENABLE && !defined(MPG_STREAM)
127
#if USB_SERIAL_CDC
128
#define MPG_STREAM 0
129
#else
130
#define MPG_STREAM 1
131
#endif
132
#endif
133
134
#if DISPLAY_ENABLE == 2
135
#ifdef I2C_ENABLE
136
#undef I2C_ENABLE
137
#endif
138
#define I2C_ENABLE 1
139
#endif
140
141
#ifndef EEPROM_ENABLE
142
#define EEPROM_ENABLE 0
143
#endif
144
#ifndef EEPROM_IS_FRAM
145
#define EEPROM_IS_FRAM 0
146
#endif
147
148
#ifndef I2C_ENABLE
149
#if EEPROM_ENABLE || KEYPAD_ENABLE == 1 || DISPLAY_ENABLE == 1 || DISPLAY_ENABLE == 2 || I2C_STROBE_ENABLE || (TRINAMIC_ENABLE && TRINAMIC_I2C)
150
#define I2C_ENABLE 1
151
#else
152
#define I2C_ENABLE 0
153
#endif
154
#endif
155
156
#ifndef SPINDLE_SYNC_ENABLE
157
#define SPINDLE_SYNC_ENABLE 0
158
#endif
159
160
#ifndef SPINDLE_ENCODER_ENABLE
161
#if SPINDLE_SYNC_ENABLE
162
#define SPINDLE_ENCODER_ENABLE 1
163
#else
164
#define SPINDLE_ENCODER_ENABLE 0
165
#endif
166
#endif
167
168
#ifndef TRINAMIC_ENABLE
169
#define TRINAMIC_ENABLE 0
170
#endif
171
#if TRINAMIC_ENABLE == 2209
172
#ifndef TRINAMIC_UART_ENABLE
173
#define TRINAMIC_UART_ENABLE 1
174
#endif
175
#if !defined(TRINAMIC_STREAM) && TRINAMIC_UART_ENABLE == 1
176
#define TRINAMIC_STREAM 1
177
#endif
178
#else
179
#define TRINAMIC_UART_ENABLE 0
180
#endif
181
#if (TRINAMIC_ENABLE == 2130 || TRINAMIC_ENABLE == 2660 || TRINAMIC_ENABLE == 5160)
182
#if !defined(TRINAMIC_SPI_ENABLE)
183
#define TRINAMIC_SPI_ENABLE 1
184
#endif
185
#else
186
#define TRINAMIC_SPI_ENABLE 0
187
#endif
188
#ifndef TRINAMIC_I2C
189
#define TRINAMIC_I2C 0
190
#endif
191
#if TRINAMIC_ENABLE && TRINAMIC_I2C
192
#define TRINAMIC_MOTOR_ENABLE 1
193
#else
194
#define TRINAMIC_MOTOR_ENABLE 0
195
#endif
196
#ifndef TRINAMIC_DEV
197
#define TRINAMIC_DEV 0
198
#endif
199
200
#ifndef LITTLEFS_ENABLE
201
#define LITTLEFS_ENABLE 0
202
#endif
203
204
#ifndef PWM_RAMPED
205
#define PWM_RAMPED 0
206
#endif
207
#ifndef PLASMA_ENABLE
208
#define PLASMA_ENABLE 0
209
#elif PLASMA_ENABLE
210
#if defined(STEP_INJECT_ENABLE)
211
#undef STEP_INJECT_ENABLE
212
#endif
213
#define STEP_INJECT_ENABLE 1
214
#endif
215
#ifndef PPI_ENABLE
216
#define PPI_ENABLE 0
217
#endif
218
219
#if EMBROIDERY_ENABLE
220
#if defined(SDCARD_ENABLE) && SDCARD_ENABLE == 0
221
#undef SDCARD_ENABLE
222
#endif
223
#ifndef SDCARD_ENABLE
224
#define SDCARD_ENABLE 1
225
#endif
226
#endif
227
228
#ifndef SPINDLE0_ENABLE
229
#define SPINDLE0_ENABLE SPINDLE_PWM0
230
#endif
231
232
#ifndef SPINDLE1_ENABLE
233
#define SPINDLE1_ENABLE 0
234
#elif SPINDLE1_ENABLE == -1 || SPINDLE1_ENABLE == SPINDLE_ALL || SPINDLE1_ENABLE == SPINDLE_ALL_VFD
235
#warning "SPINDLE1_ENABLE cannot be set to -1, SPINDLE_ALL or SPINDLE_ALL_VFD"
236
#undef SPINDLE1_ENABLE
237
#define SPINDLE1_ENABLE 0
238
#endif
239
240
#ifndef SPINDLE2_ENABLE
241
#define SPINDLE2_ENABLE 0
242
#elif SPINDLE2_ENABLE == -1 || SPINDLE2_ENABLE == SPINDLE_ALL || SPINDLE2_ENABLE == SPINDLE_ALL_VFD
243
#warning "SPINDLE2_ENABLE cannot be set to -1, SPINDLE_ALL or SPINDLE_ALL_VFD"
244
#undef SPINDLE2_ENABLE
245
#define SPINDLE2_ENABLE 0
246
#endif
247
248
#ifndef SPINDLE3_ENABLE
249
#define SPINDLE3_ENABLE 0
250
#elif SPINDLE3_ENABLE == -1 || SPINDLE3_ENABLE == SPINDLE_ALL || SPINDLE3_ENABLE == SPINDLE_ALL_VFD
251
#warning "SPINDLE3_ENABLE cannot be set to -1, SPINDLE_ALL or SPINDLE_ALL_VFD"
252
#undef SPINDLE1_ENABLE
253
#define SPINDLE1_ENABLE 0
254
#endif
255
256
#if SPINDLE0_ENABLE == -1 || SPINDLE0_ENABLE == SPINDLE_ALL
257
#define SPINDLE_ENABLE (SPINDLE_ALL|(1<<SPINDLE1_ENABLE)|(1<<SPINDLE2_ENABLE)|(1<<SPINDLE3_ENABLE))
258
#elif SPINDLE0_ENABLE == SPINDLE_ALL_VFD
259
#define SPINDLE_ENABLE (SPINDLE_ALL_VFD|SPINDLE_ALL|(1<<SPINDLE1_ENABLE)|(1<<SPINDLE2_ENABLE)|(1<<SPINDLE3_ENABLE))
260
#else
261
#define SPINDLE_ENABLE ((1<<SPINDLE0_ENABLE)|(1<<SPINDLE1_ENABLE)|(1<<SPINDLE2_ENABLE)|(1<<SPINDLE3_ENABLE))
262
#endif
263
264
// Driver spindle 0
265
266
#if SPINDLE_ENABLE & ((1<<SPINDLE_PWM0)|(1<<SPINDLE_PWM0_NODIR)|(1<<SPINDLE_ONOFF0)|(1<<SPINDLE_ONOFF0_DIR))
267
#define DRIVER_SPINDLE_ENABLE 1
268
#else
269
#define DRIVER_SPINDLE_ENABLE 0
270
#endif
271
272
#if SPINDLE_ENABLE & ((1<<SPINDLE_PWM0)|(1<<SPINDLE_ONOFF0_DIR))
273
#define DRIVER_SPINDLE_DIR_ENABLE 1
274
#else
275
#define DRIVER_SPINDLE_DIR_ENABLE 0
276
#endif
277
278
#if SPINDLE_ENABLE & ((1<<SPINDLE_PWM0)|(1<<SPINDLE_PWM0_NODIR))
279
#define DRIVER_SPINDLE_PWM_ENABLE 1
280
#define DRIVER_SPINDLE_NAME "PWM"
281
#else
282
#define DRIVER_SPINDLE_PWM_ENABLE 0
283
#if DRIVER_SPINDLE_ENABLE
284
#define DRIVER_SPINDLE_NAME "Basic"
285
#endif
286
#endif
287
288
// Driver spindle 1
289
290
#if SPINDLE_ENABLE & ((1<<SPINDLE_PWM1)|(1<<SPINDLE_PWM1_NODIR)|(1<<SPINDLE_ONOFF1)|(1<<SPINDLE_ONOFF1_DIR))
291
#define DRIVER_SPINDLE1_ENABLE 1
292
#else
293
#define DRIVER_SPINDLE1_ENABLE 0
294
#endif
295
296
#if SPINDLE_ENABLE & ((1<<SPINDLE_PWM1)|(1<<SPINDLE_ONOFF1_DIR))
297
#define DRIVER_SPINDLE1_DIR_ENABLE 1
298
#else
299
#define DRIVER_SPINDLE1_DIR_ENABLE 0
300
#endif
301
302
#if SPINDLE_ENABLE & ((1<<SPINDLE_PWM1)|(1<<SPINDLE_PWM1_NODIR))
303
#define DRIVER_SPINDLE1_PWM_ENABLE 1
304
#define DRIVER_SPINDLE1_NAME "PWM2"
305
#else
306
#define DRIVER_SPINDLE1_PWM_ENABLE 0
307
#if DRIVER_SPINDLE1_ENABLE
308
#define DRIVER_SPINDLE1_NAME "Basic2"
309
#endif
310
#endif
311
312
//
313
314
#ifndef VFD_ENABLE
315
#if SPINDLE_ENABLE & SPINDLE_ALL_VFD
316
#define VFD_ENABLE 1
317
#else
318
#define VFD_ENABLE 0
319
#endif
320
#endif
321
322
#define MODBUS_RTU_ENABLED 0b001
323
#define MODBUS_RTU_DIR_ENABLED 0b010
324
#define MODBUS_TCP_ENABLED 0b100
325
326
#if MODBUS_ENABLE == 2
327
#undef MODBUS_ENABLE
328
#define MODBUS_ENABLE 0b011
329
#endif
330
331
#ifndef MODBUS_ENABLE
332
#if VFD_ENABLE
333
#define MODBUS_ENABLE 1
334
#else
335
#define MODBUS_ENABLE 0
336
#endif
337
#endif
338
339
#ifndef STEP_INJECT_ENABLE
340
#if SPINDLE_ENABLE & (1<<SPINDLE_STEPPER)
341
#define STEP_INJECT_ENABLE 1
342
#else
343
#define STEP_INJECT_ENABLE 0
344
#endif
345
#endif
346
347
#ifndef QEI_ENABLE
348
#define QEI_ENABLE 0
349
#endif
350
#ifndef QEI_SELECT_ENABLE
351
#define QEI_SELECT_ENABLE 0
352
#endif
353
#ifndef ODOMETER_ENABLE
354
#define ODOMETER_ENABLE 0
355
#endif
356
#ifndef OPENPNP_ENABLE
357
#define OPENPNP_ENABLE 0
358
#endif
359
#ifndef FANS_ENABLE
360
#define FANS_ENABLE 0
361
#endif
362
#ifndef LIMITS_OVERRIDE_ENABLE
363
#define LIMITS_OVERRIDE_ENABLE 0
364
#endif
365
366
#ifndef BLUETOOTH_ENABLE
367
#define BLUETOOTH_ENABLE 0
368
#endif
369
#if BLUETOOTH_ENABLE
370
#ifndef BLUETOOTH_DEVICE
371
#define BLUETOOTH_DEVICE "grblHAL"
372
#endif
373
#ifndef BLUETOOTH_SERVICE
374
#define BLUETOOTH_SERVICE "grblHAL Serial Port"
// Minimum 8 characters, or blank for open
375
#endif
376
#endif
377
378
// Optional control signals
379
380
#ifndef SAFETY_DOOR_ENABLE
381
#define SAFETY_DOOR_ENABLE 0
382
#endif
383
#ifndef PROBE_DISCONNECT_ENABLE
384
#define PROBE_DISCONNECT_ENABLE 0
385
#endif
386
#ifndef STOP_DISABLE_ENABLE
387
#define STOP_DISABLE_ENABLE 0
388
#endif
389
#ifndef BLOCK_DELETE_ENABLE
390
#define BLOCK_DELETE_ENABLE 0
391
#endif
392
#ifndef SINGLE_BLOCK_ENABLE
393
#define SINGLE_BLOCK_ENABLE 0
394
#endif
395
#ifndef MOTOR_FAULT_ENABLE
396
#define MOTOR_FAULT_ENABLE 0
397
#endif
398
#ifndef MOTOR_WARNING_ENABLE
399
#define MOTOR_WARNING_ENABLE 0
400
#endif
401
#ifndef LIMITS_OVERRIDE_ENABLE
402
#define LIMITS_OVERRIDE_ENABLE 0
403
#endif
404
405
#if SAFETY_DOOR_ENABLE && defined(NO_SAFETY_DOOR_SUPPORT)
406
#error "Driver does not support safety door functionality!"
407
#endif
408
409
#ifndef ESTOP_ENABLE
410
#if COMPATIBILITY_LEVEL <= 1
411
#define ESTOP_ENABLE 1
412
#else
413
#define ESTOP_ENABLE 0
414
#endif
415
#elif ESTOP_ENABLE && COMPATIBILITY_LEVEL > 1
416
#warning "Enabling ESTOP may not work with all senders!"
417
#endif
418
419
//
420
421
#ifndef WIFI_ENABLE
422
#define WIFI_ENABLE 0
423
#endif
424
425
#ifndef WEBUI_ENABLE
426
#define WEBUI_ENABLE 0
427
#endif
428
429
#ifndef WEBUI_AUTH_ENABLE
430
#define WEBUI_AUTH_ENABLE 0
431
#endif
432
433
#ifndef WEBUI_INFLASH
434
#define WEBUI_INFLASH 0
435
#endif
436
437
#if WEBUI_ENABLE
438
439
#if !WIFI_ENABLE
440
#ifdef ETHERNET_ENABLE
441
#undef ETHERNET_ENABLE
442
#endif
443
#define ETHERNET_ENABLE 1
444
#endif
445
#ifdef HTTP_ENABLE
446
#undef HTTP_ENABLE
447
#endif
448
#define HTTP_ENABLE 1
449
#ifdef WEBSOCKET_ENABLE
450
#undef WEBSOCKET_ENABLE
451
#endif
452
#define WEBSOCKET_ENABLE 1
453
#if defined(SDCARD_ENABLE) && SDCARD_ENABLE == 0
454
#undef SDCARD_ENABLE
455
#endif
456
#ifndef SDCARD_ENABLE
457
#define SDCARD_ENABLE 1
458
#endif
459
#endif
460
461
#ifndef ETHERNET_ENABLE
462
#define ETHERNET_ENABLE 0
463
#endif
464
#ifndef TELNET_ENABLE
465
#define TELNET_ENABLE 0
466
#endif
467
#ifndef HTTP_ENABLE
468
#define HTTP_ENABLE 0
469
#endif
470
#ifndef WEBSOCKET_ENABLE
471
#define WEBSOCKET_ENABLE 0
472
#endif
473
#ifndef FTP_ENABLE
474
#define FTP_ENABLE 0
475
#elif !SDCARD_ENABLE
476
#undef FTP_ENABLE
477
#define FTP_ENABLE 0
478
#endif
479
#ifndef MDNS_ENABLE
480
#define MDNS_ENABLE 0
481
#endif
482
#ifndef SSDP_ENABLE
483
#define SSDP_ENABLE 0
484
#endif
485
#if SSDP_ENABLE && !HTTP_ENABLE
486
#undef HTTP_ENABLE
487
#define HTTP_ENABLE 1
488
#endif
489
#ifndef MQTT_ENABLE
490
#define MQTT_ENABLE 0
491
#endif
492
493
#if ETHERNET_ENABLE || WIFI_ENABLE
494
#ifndef NETWORK_HOSTNAME
495
#define NETWORK_HOSTNAME "grblHAL"
496
#endif
497
#ifndef NETWORK_IPMODE
498
#define NETWORK_IPMODE 1
// 0 = static, 1 = DHCP, 2 = AutoIP
499
#endif
500
#ifndef NETWORK_IP
501
#define NETWORK_IP "192.168.5.1"
502
#endif
503
#ifndef NETWORK_GATEWAY
504
#define NETWORK_GATEWAY "192.168.5.1"
505
#endif
506
#ifndef NETWORK_MASK
507
#define NETWORK_MASK "255.255.255.0"
508
#endif
509
#ifndef NETWORK_FTP_PORT
510
#define NETWORK_FTP_PORT 21
511
#endif
512
#ifndef NETWORK_TELNET_PORT
513
#define NETWORK_TELNET_PORT 23
514
#endif
515
#ifndef NETWORK_HTTP_PORT
516
#define NETWORK_HTTP_PORT 80
517
#endif
518
#ifndef NETWORK_MODBUS_PORT
519
#define NETWORK_MODBUS_PORT 502
520
#endif
521
#ifndef NETWORK_MQTT_PORT
522
#define NETWORK_MQTT_PORT 1883
523
#endif
524
#ifndef NETWORK_WEBSOCKET_PORT
525
#if HTTP_ENABLE
526
#define NETWORK_WEBSOCKET_PORT 81
527
#else
528
#define NETWORK_WEBSOCKET_PORT 80
529
#endif
530
#endif
531
#if NETWORK_IPMODE < 0 || NETWORK_IPMODE > 2
532
#error "Invalid IP mode selected!"
533
#endif
534
#if HTTP_ENABLE && NETWORK_WEBSOCKET_PORT == NETWORK_HTTP_PORT
535
#warning "HTTP and WebSocket protocols cannot share the same port!"
536
#endif
537
#endif
// ETHERNET_ENABLE || WIFI_ENABLE
538
539
#if WIFI_ENABLE
540
541
#ifndef NETWORK_STA_SSID
542
#define NETWORK_STA_SSID ""
543
#endif
544
#ifndef NETWORK_STA_PASSWORD
545
#define NETWORK_STA_PASSWORD ""
546
#endif
547
#ifndef NETWORK_STA_HOSTNAME
548
#define NETWORK_STA_HOSTNAME "grblHAL"
549
#endif
550
#ifndef NETWORK_STA_IPMODE
551
#define NETWORK_STA_IPMODE 1
// DHCP
552
#endif
553
#ifndef NETWORK_STA_IP
554
#define NETWORK_STA_IP "192.168.5.1"
555
#endif
556
#ifndef NETWORK_STA_GATEWAY
557
#define NETWORK_STA_GATEWAY "192.168.5.1"
558
#endif
559
#ifndef NETWORK_STA_MASK
560
#define NETWORK_STA_MASK "255.255.255.0"
561
#endif
562
563
#if WIFI_SOFTAP > 0
564
#ifndef NETWORK_AP_SSID
565
#define NETWORK_AP_SSID "grblHAL_AP"
566
#endif
567
#ifndef NETWORK_AP_PASSWORD
568
#define NETWORK_AP_PASSWORD "grblHALpwd"
569
#endif
570
#ifndef NETWORK_AP_HOSTNAME
571
#define NETWORK_AP_HOSTNAME "grblHAL_AP"
572
#endif
573
#ifndef NETWORK_AP_IPMODE
574
#define NETWORK_AP_IPMODE 0
// static
575
#endif
576
#ifndef NETWORK_AP_IP
577
#define NETWORK_AP_IP "192.168.5.1"
578
#endif
579
#ifndef NETWORK_AP_GATEWAY
580
#define NETWORK_AP_GATEWAY "192.168.5.1"
581
#endif
582
#ifndef NETWORK_AP_MASK
583
#define NETWORK_AP_MASK "255.255.255.0"
584
#endif
585
#endif
// WIFI_SOFTAP
586
#endif
// WIFI_ENABLE
587
588
#ifndef SDCARD_ENABLE
589
#define SDCARD_ENABLE 0
590
#endif
591
592
#ifndef SPI_ENABLE
593
#if SDCARD_ENABLE || TRINAMIC_SPI_ENABLE
594
#define SPI_ENABLE 1
595
#else
596
#define SPI_ENABLE 0
597
#endif
598
#endif
599
600
/*EOF*/
hal.h
HAL function pointers and data structures definitions.
nuts_bolts.h
STM
grblHAL Driver STM32F756
grbl
driver_opts.h
Generated by
1.9.1