/
generic_map.h
162 lines (132 loc) · 4.49 KB
/
generic_map.h
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
/*
generic_map.h - driver code for STM32F103xx ARM processors
Part of grblHAL
Copyright (c) 2020-2023 Terje Io
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/
#if N_ABC_MOTORS > 1 || N_GANGED
#error "Axis configuration is not supported!"
#endif
#if !defined(STM32F103xB)
#define HAS_IOPORTS
#endif
// Define step pulse output pins.
#define STEP_PORT GPIOA
#define X_STEP_PIN 0
#define Y_STEP_PIN 1
#define Z_STEP_PIN 2
#define STEP_OUTMODE GPIO_MAP
// Define step direction output pins.
#define DIRECTION_PORT GPIOA
#define X_DIRECTION_PIN 4
#define Y_DIRECTION_PIN 5
#define Z_DIRECTION_PIN 6
#define DIRECTION_OUTMODE GPIO_MAP
// Define stepper driver enable/disable output pin.
#define STEPPERS_ENABLE_PORT GPIOA
#define STEPPERS_ENABLE_PIN 15
// Define homing/hard limit switch input pins.
#define LIMIT_PORT GPIOB
#define X_LIMIT_PIN 12
#define Y_LIMIT_PIN 13
#define Z_LIMIT_PIN 14
#define LIMIT_INMODE GPIO_SHIFT12
// Define ganged axis or A axis step pulse and step direction output pins.
#if N_ABC_MOTORS == 1
#define M3_AVAILABLE
#define M3_STEP_PORT STEP_PORT
#define M3_STEP_PIN 3
#define M3_DIRECTION_PORT DIRECTION_PORT
#define M3_DIRECTION_PIN 7
#define M3_LIMIT_PORT LIMIT_PORT
#define M3_LIMIT_PIN 15
#endif
// Define driver spindle pins
#if DRIVER_SPINDLE_PWM_ENABLE
#define SPINDLE_PWM_PORT_BASE GPIOA_BASE
#define SPINDLE_PWM_PIN 8
#elif defined(HAS_IOPORTS)
#define AUXOUTPUT0_PORT GPIOA
#define AUXOUTPUT0_PIN 8
#endif
#if DRIVER_SPINDLE_DIR_ENABLE
#define SPINDLE_DIRECTION_PORT GPIOB
#define SPINDLE_DIRECTION_PIN 0
#elif defined(HAS_IOPORTS)
#define AUXOUTPUT1_PORT GPIOB
#define AUXOUTPUT1_PIN 0
#endif
#if DRIVER_SPINDLE_ENABLE
#define SPINDLE_ENABLE_PORT GPIOB
#define SPINDLE_ENABLE_PIN 1
#elif defined(HAS_IOPORTS)
#define AUXOUTPUT2_PORT GPIOB
#define AUXOUTPUT2_PIN 1
#endif
// Define flood and mist coolant enable output pins.
#define COOLANT_FLOOD_PORT GPIOB
#define COOLANT_FLOOD_PIN 4
#define COOLANT_MIST_PORT GPIOB
#define COOLANT_MIST_PIN 3
// Define user-control controls (cycle start, reset, feed hold) input pins.
#define CONTROL_PORT GPIOB
#define RESET_PIN 5
#define FEED_HOLD_PIN 6
#define CYCLE_START_PIN 7
#define CONTROL_INMODE GPIO_SHIFT5
#ifdef HAS_IOPORTS
#define AUXINPUT0_PORT GPIOB
#define AUXINPUT0_PIN 8
#define AUXINPUT1_PORT GPIOA
#define AUXINPUT1_PIN 15
#define AUXINPUT2_PORT GPIOA
#define AUXINPUT2_PIN 7
#if PROBE_ENABLE
#define PROBE_PORT AUXINPUT2_PORT
#define PROBE_PIN AUXINPUT2_PIN
#endif
#if I2C_STROBE_ENABLE
#define I2C_STROBE_PORT AUXINPUT1_PORT
#define I2C_STROBE_PIN AUXINPUT1_PIN
#endif
#if SAFETY_DOOR_ENABLE
#define SAFETY_DOOR_PORT AUXINPUT0_PORT
#define SAFETY_DOOR_PIN AUXINPUT0_PIN
#elif MOTOR_FAULT_ENABLE
#define MOTOR_FAULT_PORT AUXINPUT0_PORT
#define MOTOR_FAULT_PIN AUXINPUT0_PIN
#endif
#else
// Define probe switch input pin.
#define PROBE_PORT GPIOA
#define PROBE_PIN 7
#if I2C_STROBE_ENABLE
#define I2C_STROBE_PORT GPIOA
#define I2C_STROBE_PIN 15
#endif
#if SAFETY_DOOR_ENABLE
#define SAFETY_DOOR_PORT GPIOB
#define SAFETY_DOOR_PIN 8
#endif
#endif
#if SDCARD_ENABLE
#define SPI1_REMAP
#define SD_CS_PORT GPIOA
#define SD_CS_PIN 3
// The following defines are not used but defined for reference
// Port init and remap is done by HAL_SPI_MspInit() in stm32f1xx_hal_msp.c
#define SD_IO_PORT GPIOB
#define SD_SCK_PIN 3
#define SD_MISO_PIN 4
#define SD_MOSI_PIN 5
#endif
/**/