Prusa MINI Firmware overview
|
Go to the documentation of this file.
18 #ifndef _PINS_ARDUINO_H_
19 #define _PINS_ARDUINO_H_
210 #define MAX_ANALOG_INPUTS 24
212 "Core NUM_ANALOG_INPUTS limited to MAX_ANALOG_INPUTS");
214 "First analog pin value (A0) must be greater than or equal to NUM_ANALOG_INPUTS");
217 #define AEND (NUM_ANALOG_FIRST + NUM_ANALOG_INPUTS)
219 #if NUM_ANALOG_INPUTS > 0
220 #define PIN_A0 NUM_ANALOG_FIRST
221 static const uint8_t A0 = PIN_A0;
223 #if NUM_ANALOG_INPUTS > 1
224 #define PIN_A1 (PIN_A0 + 1)
225 static const uint8_t A1 = PIN_A1;
227 #if NUM_ANALOG_INPUTS > 2
228 #define PIN_A2 (PIN_A1 + 1)
229 static const uint8_t A2 = PIN_A2;
231 #if NUM_ANALOG_INPUTS > 3
232 #define PIN_A3 (PIN_A2 + 1)
233 static const uint8_t A3 = PIN_A3;
235 #if NUM_ANALOG_INPUTS > 4
236 #define PIN_A4 (PIN_A3 + 1)
237 static const uint8_t A4 = PIN_A4;
239 #if NUM_ANALOG_INPUTS > 5
240 #define PIN_A5 (PIN_A4 + 1)
241 static const uint8_t A5 = PIN_A5;
243 #if NUM_ANALOG_INPUTS > 6
244 #define PIN_A6 (PIN_A5 + 1)
245 static const uint8_t A6 = PIN_A6;
247 #if NUM_ANALOG_INPUTS > 7
248 #define PIN_A7 (PIN_A6 + 1)
249 static const uint8_t A7 = PIN_A7;
251 #if NUM_ANALOG_INPUTS > 8
252 #define PIN_A8 (PIN_A7 + 1)
253 static const uint8_t A8 = PIN_A8;
255 #if NUM_ANALOG_INPUTS > 9
256 #define PIN_A9 (PIN_A8 + 1)
257 static const uint8_t A9 = PIN_A9;
259 #if NUM_ANALOG_INPUTS > 10
260 #define PIN_A10 (PIN_A9 + 1)
261 static const uint8_t A10 = PIN_A10;
263 #if NUM_ANALOG_INPUTS > 11
264 #define PIN_A11 (PIN_A10 + 1)
265 static const uint8_t A11 = PIN_A11;
267 #if NUM_ANALOG_INPUTS > 12
268 #define PIN_A12 (PIN_A11 + 1)
269 static const uint8_t A12 = PIN_A12;
271 #if NUM_ANALOG_INPUTS > 13
272 #define PIN_A13 (PIN_A12 + 1)
273 static const uint8_t A13 = PIN_A13;
275 #if NUM_ANALOG_INPUTS > 14
276 #define PIN_A14 (PIN_A13 + 1)
277 static const uint8_t A14 = PIN_A14;
279 #if NUM_ANALOG_INPUTS > 15
280 #define PIN_A15 (PIN_A14 + 1)
281 static const uint8_t A15 = PIN_A15;
283 #if NUM_ANALOG_INPUTS > 16
284 #define PIN_A16 (PIN_A15 + 1)
285 static const uint8_t A16 = PIN_A16;
287 #if NUM_ANALOG_INPUTS > 17
288 #define PIN_A17 (PIN_A16 + 1)
289 static const uint8_t A17 = PIN_A17;
291 #if NUM_ANALOG_INPUTS > 18
292 #define PIN_A18 (PIN_A17 + 1)
293 static const uint8_t A18 = PIN_A18;
295 #if NUM_ANALOG_INPUTS > 19
296 #define PIN_A19 (PIN_A18 + 1)
297 static const uint8_t A19 = PIN_A19;
299 #if NUM_ANALOG_INPUTS > 20
300 #define PIN_A20 (PIN_A19 + 1)
301 static const uint8_t A20 = PIN_A20;
303 #if NUM_ANALOG_INPUTS > 21
304 #define PIN_A21 (PIN_A20 + 1)
305 static const uint8_t A21 = PIN_A21;
307 #if NUM_ANALOG_INPUTS > 22
308 #define PIN_A22 (PIN_A21 + 1)
309 static const uint8_t A22 = PIN_A22;
311 #if NUM_ANALOG_INPUTS > 23
312 #define PIN_A23 (PIN_A22 + 1)
313 static const uint8_t A23 = PIN_A23;
319 #define PIN_SPI_SS 10
322 #define PIN_SPI_SS1 4
325 #define PIN_SPI_SS2 7
328 #define PIN_SPI_SS3 8
331 #define PIN_SPI_MOSI 11
334 #define PIN_SPI_MISO 12
337 #define PIN_SPI_SCK 13
350 #define PIN_WIRE_SDA 14
353 #define PIN_WIRE_SCL 15
363 #define NOT_AN_INTERRUPT NC // -1
367 #define digitalPinToPinName(p) (((uint32_t)p < NUM_DIGITAL_PINS) ? digitalPin[p] : NC)
373 #define analogInputToDigitalPin(p) (((uint32_t)p < NUM_ANALOG_INPUTS) ? (p + A0) : p)
375 #define analogInputToPinName(p) (digitalPinToPinName(analogInputToDigitalPin(p)))
377 #define digitalPinToInterrupt(p) (digitalPinIsValid(p) ? p : NOT_AN_INTERRUPT)
379 #define digitalPinHasI2C(p) (pin_in_pinmap(digitalPinToPinName(p), PinMap_I2C_SDA) || pin_in_pinmap(digitalPinToPinName(p), PinMap_I2C_SCL))
380 #define digitalPinHasPWM(p) (pin_in_pinmap(digitalPinToPinName(p), PinMap_PWM))
381 #define digitalPinHasSerial(p) (pin_in_pinmap(digitalPinToPinName(p), PinMap_UART_RX) || pin_in_pinmap(digitalPinToPinName(p), PinMap_UART_TX))
382 #define digitalPinHasSPI(p) (pin_in_pinmap(digitalPinToPinName(p), PinMap_SPI_MOSI) || pin_in_pinmap(digitalPinToPinName(p), PinMap_SPI_MISO) || pin_in_pinmap(digitalPinToPinName(p), PinMap_SPI_SCLK) || pin_in_pinmap(digitalPinToPinName(p), PinMap_SPI_SSEL))
384 #define digitalPinToPort(p) (get_GPIO_Port(STM_PORT(digitalPinToPinName(p))))
385 #define digitalPinToBitMask(p) (STM_GPIO_PIN(digitalPinToPinName(p)))
387 #define analogInPinToBit(p) (STM_GPIO_PIN(digitalPinToPinName(p)))
388 #define portOutputRegister(P) (&(P->ODR))
389 #define portInputRegister(P) (&(P->IDR))
391 #define portSetRegister(P) (&(P->BSRR))
392 #if defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32F7xx)
394 #define portClearRegister(P) (&(P->BSRR))
396 #define portClearRegister(P) (&(P->BRR))
399 #if defined(STM32F1xx)
404 #define portModeRegister(P) (&(P->CRL))
406 #define portModeRegister(P) (&(P->MODER))
408 #define portConfigRegister(P) (portModeRegister(P))
410 #define digitalPinIsValid(p) (digitalPinToPinName(p) != NC)
414 #define digitalPinFirstOccurence(p) (pinNametoDigitalPin(digitalPinToPinName(p)))
418 #if defined(PIN_SERIAL_RX) && defined(PIN_SERIAL_TX)
419 #define pinIsSerial(p) ((digitalPinFirstOccurence(p) == PIN_SERIAL_RX) || (digitalPinFirstOccurence(p) == PIN_SERIAL_TX))
427 #ifndef ADC_RESOLUTION
428 #define ADC_RESOLUTION 12
430 #ifndef DACC_RESOLUTION
431 #define DACC_RESOLUTION 12
433 #ifndef PWM_RESOLUTION
434 #define PWM_RESOLUTION 8
436 #ifndef PWM_FREQUENCY
437 #define PWM_FREQUENCY 1000
439 #ifndef PWM_MAX_DUTY_CYCLE
440 #define PWM_MAX_DUTY_CYCLE 255
Definition: pins_arduino.h:174
Definition: pins_arduino.h:205
Definition: pins_arduino.h:73
Definition: pins_arduino.h:172
Definition: pins_arduino.h:64
Definition: pins_arduino.h:182
Definition: pins_arduino.h:100
Definition: pins_arduino.h:80
Definition: pins_arduino.h:111
Definition: pins_arduino.h:105
Definition: pins_arduino.h:67
Definition: pins_arduino.h:59
Definition: pins_arduino.h:35
Definition: pins_arduino.h:161
Definition: pins_arduino.h:169
Definition: pins_arduino.h:144
Definition: pins_arduino.h:87
Definition: pins_arduino.h:31
Definition: pins_arduino.h:55
Definition: pins_arduino.h:136
Definition: pins_arduino.h:137
Definition: pins_arduino.h:103
Definition: pins_arduino.h:29
Definition: pins_arduino.h:187
Definition: pins_arduino.h:58
Definition: pins_arduino.h:173
#define PIN_SPI_SS1
Definition: pins_arduino.h:322
Definition: pins_arduino.h:91
PinName
Definition: PinNames.h:11
Definition: pins_arduino.h:119
Definition: pins_arduino.h:102
Definition: pins_arduino.h:42
Definition: pins_arduino.h:43
Definition: pins_arduino.h:122
Definition: pins_arduino.h:151
Definition: pins_arduino.h:188
Definition: pins_arduino.h:90
Definition: pins_arduino.h:126
Definition: pins_arduino.h:47
Definition: pins_arduino.h:139
Definition: pins_arduino.h:143
Definition: pins_arduino.h:162
Definition: pins_arduino.h:61
static const uint8_t MOSI
Definition: pins_arduino.h:344
Definition: pins_arduino.h:109
Definition: pins_arduino.h:202
Definition: pins_arduino.h:131
static const uint8_t SDA
Definition: pins_arduino.h:356
#define NUM_ANALOG_FIRST
Definition: variant.h:216
Definition: pins_arduino.h:177
#define PIN_SPI_SS2
Definition: pins_arduino.h:325
Definition: pins_arduino.h:32
Definition: pins_arduino.h:181
Definition: pins_arduino.h:39
Definition: pins_arduino.h:108
Definition: pins_arduino.h:53
Definition: pins_arduino.h:148
Definition: pins_arduino.h:70
Definition: pins_arduino.h:194
Definition: pins_arduino.h:125
Definition: pins_arduino.h:49
Definition: pins_arduino.h:179
Definition: pins_arduino.h:74
Definition: pins_arduino.h:41
Definition: pins_arduino.h:140
Definition: pins_arduino.h:46
Definition: pins_arduino.h:50
Definition: pins_arduino.h:165
#define PIN_SPI_SS
Definition: pins_arduino.h:319
Definition: pins_arduino.h:121
Definition: pins_arduino.h:116
Definition: pins_arduino.h:114
Definition: pins_arduino.h:95
Definition: pins_arduino.h:184
Definition: pins_arduino.h:146
Definition: pins_arduino.h:124
Definition: pins_arduino.h:170
Definition: pins_arduino.h:156
_Static_assert(LastPort<=0x0F, "PortName must be less than 16")
Definition: pins_arduino.h:92
Definition: pins_arduino.h:195
Definition: pins_arduino.h:94
Definition: pins_arduino.h:130
Definition: pins_arduino.h:112
Definition: pins_arduino.h:37
Definition: pins_arduino.h:65
#define PIN_SPI_SS3
Definition: pins_arduino.h:328
Definition: pins_arduino.h:163
Definition: pins_arduino.h:190
Definition: pins_arduino.h:158
Definition: pins_arduino.h:132
Definition: pins_arduino.h:171
Definition: pins_arduino.h:51
Definition: pins_arduino.h:150
Definition: pins_arduino.h:115
uint32_t pinNametoDigitalPin(PinName p)
Definition: pins_arduino.h:155
Definition: pins_arduino.h:129
Definition: pins_arduino.h:107
Definition: pins_arduino.h:36
static const uint8_t SS3
Definition: pins_arduino.h:343
#define PIN_SPI_MISO
Definition: pins_arduino.h:334
Definition: pins_arduino.h:120
#define PIN_WIRE_SCL
Definition: pins_arduino.h:353
Definition: pins_arduino.h:203
Definition: pins_arduino.h:153
Definition: pins_arduino.h:60
Definition: pins_arduino.h:54
Definition: pins_arduino.h:149
Definition: pins_arduino.h:167
Definition: pins_arduino.h:189
static const uint8_t SCK
Definition: pins_arduino.h:346
Definition: pins_arduino.h:176
Definition: pins_arduino.h:138
Definition: pins_arduino.h:152
Definition: pins_arduino.h:79
Definition: pins_arduino.h:166
Definition: pins_arduino.h:118
#define PIN_WIRE_SDA
Definition: pins_arduino.h:350
Definition: pins_arduino.h:196
Definition: pins_arduino.h:113
Definition: pins_arduino.h:48
Definition: pins_arduino.h:178
Definition: pins_arduino.h:123
Definition: pins_arduino.h:93
Definition: pins_arduino.h:81
const uint8_t[]
Definition: 404_html.c:3
Definition: pins_arduino.h:86
Definition: pins_arduino.h:201
static const uint8_t SS2
Definition: pins_arduino.h:342
Definition: pins_arduino.h:183
Definition: pins_arduino.h:192
Definition: pins_arduino.h:68
#define PIN_SPI_MOSI
Definition: pins_arduino.h:331
Definition: pins_arduino.h:88
Definition: pins_arduino.h:82
Definition: pins_arduino.h:69
Definition: pins_arduino.h:63
Definition: pins_arduino.h:135
Definition: pins_arduino.h:99
Definition: pins_arduino.h:200
Definition: pins_arduino.h:191
Definition: pins_arduino.h:141
Definition: pins_arduino.h:199
constexpr uint8_t NUM_ANALOG_INPUTS
Definition: pinmapping.h:33
Definition: pins_arduino.h:76
Definition: pins_arduino.h:30
Definition: pins_arduino.h:106
Definition: pins_arduino.h:56
Definition: pins_arduino.h:147
Definition: pins_arduino.h:117
Definition: pins_arduino.h:34
Definition: pins_arduino.h:62
Definition: pins_arduino.h:133
static const uint8_t SS
Definition: pins_arduino.h:340
Definition: pins_arduino.h:204
#define PIN_SPI_SCK
Definition: pins_arduino.h:337
Definition: pins_arduino.h:154
Definition: pins_arduino.h:160
Definition: pins_arduino.h:185
Definition: pins_arduino.h:159
static const uint8_t SS1
Definition: pins_arduino.h:341
Definition: pins_arduino.h:142
Definition: pins_arduino.h:175
Definition: pins_arduino.h:157
#define MAX_ANALOG_INPUTS
Definition: pins_arduino.h:210
Definition: pins_arduino.h:52
Definition: pins_arduino.h:78
Definition: pins_arduino.h:97
Definition: pins_arduino.h:33
Definition: pins_arduino.h:38
Definition: pins_arduino.h:127
Definition: pins_arduino.h:84
Definition: pins_arduino.h:145
static const uint8_t MISO
Definition: pins_arduino.h:345
Definition: pins_arduino.h:89
Definition: pins_arduino.h:193
Definition: pins_arduino.h:71
Definition: pins_arduino.h:44
Definition: pins_arduino.h:164
Definition: pins_arduino.h:77
Definition: pins_arduino.h:83
Definition: pins_arduino.h:72
Definition: pins_arduino.h:128
Definition: pins_arduino.h:168
Definition: pins_arduino.h:198
Definition: pins_arduino.h:45
Definition: pins_arduino.h:85
Definition: pins_arduino.h:180
Definition: pins_arduino.h:57
Definition: pins_arduino.h:186
Definition: pins_arduino.h:101
static const uint8_t SCL
Definition: pins_arduino.h:357
Definition: pins_arduino.h:75
Definition: pins_arduino.h:134
Definition: pins_arduino.h:98
Definition: PortNames.h:73
Definition: pins_arduino.h:197
Definition: pins_arduino.h:110
Definition: pins_arduino.h:40
Definition: pins_arduino.h:104
Definition: pins_arduino.h:66
Definition: pins_arduino.h:96