forked from grblHAL/RP2040
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pico_cnc_map.h
170 lines (143 loc) · 4.35 KB
/
pico_cnc_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
163
164
165
166
167
168
169
170
/*
pico_cnc_map.h - driver code for RP2040 ARM processors
Part of grblHAL
Copyright (c) 2021-2022 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/>.
*/
#include <stdint.h>
#if TRINAMIC_ENABLE
#error Trinamic plugin not supported!
#endif
#if N_ABC_MOTORS > 1
#error "Axis configuration is not supported!"
#endif
#define BOARD_NAME "PicoCNC"
#define HAS_BOARD_INIT
typedef union {
uint32_t value;
struct {
uint32_t aux7_out :1,
aux6_out :1,
aux5_out :1,
aux4_out :1,
aux3_out :1,
aux2_out :1,
aux1_out :1,
aux0_out :1,
flood_ena :1,
mist_ena :1,
spindle_ena :1,
spindle_dir :1,
m3_ena :1,
z_ena :1,
y_ena :1,
x_ena :1,
unused :16;
};
} output_sr_t;
typedef union {
uint8_t value;
struct {
uint8_t m3_dir :1,
z_dir :1,
y_dir :1,
x_dir :1,
m3_step :1,
z_step :1,
y_step :1,
x_step :1;
};
} step_dir_t;
typedef union {
uint32_t value;
struct {
step_dir_t set;
step_dir_t reset;
uint16_t unused;
};
} step_dir_sr_t;
// Define step pulse output pins.
#define SD_SHIFT_REGISTER 8
#define SD_SR_DATA_PIN 14
#define SD_SR_SCK_PIN 15 // includes next pin (16)
// Define output signals pins.
#define OUT_SHIFT_REGISTER 16
#define OUT_SR_DATA_PIN 17
#define OUT_SR_SCK_PIN 18 // includes next pin (19)
#define STEP_PORT GPIO_SR8
#define DIRECTION_PORT GPIO_SR8
#define ENABLE_PORT GPIO_SR16
#define AUX_N_OUT 8
#define AUX_OUT_MASK 0xFF
// Define ganged axis or A axis step pulse and step direction output pins.
#if N_ABC_MOTORS > 0
#define M3_AVAILABLE
#define M3_STEP_PIN 0 // Not referenced by driver code
#define M3_DIRECTION_PIN 0 // Not referenced by driver code
#define M3_LIMIT_PIN 3
#define M3_ENABLE_PIN 0 // Not referenced by driver code
#endif
// Define homing/hard limit switch input pins.
#define X_LIMIT_PIN 6
#define Y_LIMIT_PIN 5
#define Z_LIMIT_PIN 4
#define SPINDLE_PORT GPIO_SR16
#define COOLANT_PORT GPIO_SR16
// Define spindle PWM output pin.
#define SPINDLE_PWM_PORT GPIO_OUTPUT
#define SPINDLE_PWM_PIN 27
// Define user-control controls (cycle start, reset, feed hold) input pins.
#define RESET_PIN 22
#define FEED_HOLD_PIN 7
#define CYCLE_START_PIN 8
#if SAFETY_DOOR_ENABLE
#define SAFETY_DOOR_PIN 9
#endif
// Define probe switch input pin.
#define PROBE_PIN 28
#define AUX_IO0_PIN 10
#define AUX_IO1_PIN 11
#define AUX_IO2_PIN 12
#define AUX_IO3_PIN 13
#if !SDCARD_ENABLE || !defined(SAFETY_DOOR_PIN)
#if !SDCARD_ENABLE
#define AUX_INPUT0_PIN AUX_IO0_PIN
#define AUX_INPUT1_PIN AUX_IO1_PIN
#define AUX_INPUT2_PIN AUX_IO2_PIN
#if MPG_MODE != 1
#define AUX_INPUT3_PIN AUX_IO3_PIN
#endif
#ifndef SAFETY_DOOR_PIN
#define AUX_INPUT4_PIN 9
#endif
#else
#define AUX_INPUT0_PIN 9
#endif
#endif
#if I2C_ENABLE
#define I2C_PORT 0
#define I2C_SDA 20
#define I2C_SCL 21
#endif
#if SDCARD_ENABLE
#define SPI_PORT spi1
#define SD_SCK_PIN AUX_IO0_PIN
#define SD_MOSI_PIN AUX_IO1_PIN
#define SD_MISO_PIN AUX_IO2_PIN
#define SD_CS_PIN AUX_IO3_PIN
#elif MPG_MODE == 1
#define MPG_MODE_PIN AUX_IO3_PIN
#endif
#if I2C_STROBE_ENABLE
#define I2C_STROBE_PIN 26
#define I2C_STROBE_BIT (1<<I2C_STROBE_PIN)
#endif