grblHAL core  20250104
driver_opts2.h
Go to the documentation of this file.
1 /*
2  driver_opts2.h - for preprocessing options from my_machine.h, compiler symbols or from the board map file
3 
4  NOTE: This file is not used by the core, it may be included by drivers after the map file is included
5 
6  Part of grblHAL
7 
8  Copyright (c) 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 #if (DRIVER_SPINDLE_ENABLE & SPINDLE_ENA) && !defined(SPINDLE_ENABLE_PIN)
29 #warning "Selected spindle is not supported!"
30 #endif
31 
32 #if (DRIVER_SPINDLE_ENABLE & SPINDLE_DIR) && !defined(SPINDLE_DIRECTION_PIN)
33 #warning "Selected spindle is not fully supported - no direction output!"
34 #endif
35 
36 #if (DRIVER_SPINDLE_ENABLE & SPINDLE_PWM) && !defined(SPINDLE_PWM_PIN)
37 #warning "Selected spindle is not supported!"
38 #endif
39 
40 #if (DRIVER_SPINDLE1_ENABLE & SPINDLE_PWM) && !defined(SPINDLE_PWM_PIN)
41 #warning "Selected spindle 1 is not supported!"
42 #endif
43 
44 #if MPG_ENABLE == 1 && !defined(MPG_MODE_PIN)
45 #error "MPG_MODE_PIN must be defined!"
46 #endif
47 
48 #if KEYPAD_ENABLE == 1 && !defined(I2C_STROBE_PORT)
49 #error Keypad plugin not supported!
50 #elif I2C_STROBE_ENABLE && !defined(I2C_STROBE_PORT)
51 #error I2C strobe not supported!
52 #endif
53 
54 #if EEPROM_ENABLE == 0
55 #define FLASH_ENABLE 1
56 #else
57 #define FLASH_ENABLE 0
58 #endif
59 
60 #if TRINAMIC_ENABLE
61 #include "motors/trinamic.h"
62 #ifndef TRINAMIC_MIXED_DRIVERS
63 #define TRINAMIC_MIXED_DRIVERS 1
64 #endif
65 #if TRINAMIC_UART_ENABLE == 1 && !defined(TRINAMIC_STREAM)
66 #define TRINAMIC_STREAM 1
67 #endif
68 #endif
69 
70 #if USB_SERIAL_CDC && defined(SERIAL_PORT)
71 #define SP0 1
72 #else
73 #define SP0 0
74 #endif
75 
76 #ifdef SERIAL1_PORT
77 #define SP1 1
78 #else
79 #define SP1 0
80 #endif
81 
82 #ifdef SERIAL2_PORT
83 #define SP2 1
84 #else
85 #define SP2 0
86 #endif
87 
88 #if MODBUS_ENABLE & MODBUS_RTU_ENABLED
89 #define MODBUS_TEST 1
90 #else
91 #define MODBUS_TEST 0
92 #endif
93 
94 #if TRINAMIC_ENABLE && TRINAMIC_UART_ENABLE == 1
95 #define TRINAMIC_TEST 1
96 #else
97 #define TRINAMIC_TEST 0
98 #endif
99 
100 #if KEYPAD_ENABLE == 2 && MPG_ENABLE == 0
101 #define KEYPAD_TEST 1
102 #else
103 #define KEYPAD_TEST 0
104 #endif
105 
106 #if (MODBUS_TEST + KEYPAD_TEST + (MPG_ENABLE ? 1 : 0) + TRINAMIC_TEST + (BLUETOOTH_ENABLE == 2 ? 1 : 0)) > (SP0 + SP1 + SP2)
107 #error "Too many options that uses a serial port are enabled!"
108 #endif
109 
110 #undef SP0
111 #undef SP1
112 #undef SP2
113 #undef MODBUS_TEST
114 #undef KEYPAD_TEST
115 #undef TRINAMIC_TEST
116 
117 #if KEYPAD_ENABLE == 2 && !defined(KEYPAD_STREAM)
118 #if USB_SERIAL_CDC
119 #define KEYPAD_STREAM 0
120 #else
121 #define KEYPAD_STREAM 1
122 #endif
123 #if (MODBUS_ENABLE & MODBUS_RTU_ENABLED) && defined(MODBUS_RTU_STREAM) && MODBUS_RTU_STREAM == MPG_STREAM
124 #undef KEYPAD_STREAM
125 #define KEYPAD_STREAM (MODBUS_RTU_STREAM + 1)
126 #endif
127 #endif
128 
129 #if MPG_ENABLE && !defined(MPG_STREAM)
130 #if USB_SERIAL_CDC
131 #define MPG_STREAM 0
132 #else
133 #define MPG_STREAM 1
134 #endif
135 #if (MODBUS_ENABLE & MODBUS_RTU_ENABLED) && defined(MODBUS_RTU_STREAM) && MODBUS_RTU_STREAM == MPG_STREAM
136 #undef MPG_STREAM
137 #define MPG_STREAM (MODBUS_RTU_STREAM + 1)
138 #endif
139 #endif
140 
141 #if defined(COPROC_RESET_PIN) && defined(COPROC_BOOT0_PIN)
142 #define COPROC_PASSTHRU 1
143 #else
144 #define COPROC_PASSTHRU 0
145 #endif
146 
147 #ifndef COPROC_STREAM
148 #if USB_SERIAL_CDC
149 #define COPROC_STREAM 0
150 #else
151 #define COPROC_STREAM 1
152 #endif
153 #endif
154 
155