Pins Debugging for STM32 — NEEDS TESTING (#14309)
parent
052aa23efe
commit
dc02d0720d
@ -1 +1,34 @@
|
||||
#error "PINS_DEBUGGING is not yet supported for STM32!"
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#if !(defined(NUM_DIGITAL_PINS) || defined(BOARD_NR_GPIO_PINS))
|
||||
#error "M43 not supported for this board"
|
||||
#endif
|
||||
|
||||
// Strange - STM32F4 comes to HAL_STM32 rather than HAL_STM32F4 for these files
|
||||
#ifdef STM32F4
|
||||
#ifdef NUM_DIGITAL_PINS // Only in ST's Arduino core (STM32duino, STM32Core)
|
||||
#include "pinsDebug_STM32duino.h"
|
||||
#elif defined(BOARD_NR_GPIO_PINS) // Only in STM32GENERIC (Maple)
|
||||
#include "pinsDebug_STM32GENERIC.h"
|
||||
#else
|
||||
#error "M43 not supported for this board"
|
||||
#endif
|
||||
#endif
|
||||
|
@ -0,0 +1,138 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Support routines for STM32GENERIC (Maple)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Translation of routines & variables used by pinsDebug.h
|
||||
*/
|
||||
|
||||
#ifdef BOARD_NR_GPIO_PINS // Only in STM32GENERIC (Maple)
|
||||
|
||||
#ifdef __STM32F1__
|
||||
#include "../HAL_STM32F1/fastio_STM32F1.h"
|
||||
#elif defined(STM32F4)
|
||||
#include "../HAL_STM32F4/fastio_STM32F4.h"
|
||||
#elif defined(STM32F7)
|
||||
#include "../HAL_STM32F7/fastio_STM32F7.h"
|
||||
#endif
|
||||
|
||||
extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS];
|
||||
|
||||
#define NUM_DIGITAL_PINS BOARD_NR_GPIO_PINS
|
||||
#define NUMBER_PINS_TOTAL BOARD_NR_GPIO_PINS
|
||||
#define VALID_PIN(pin) (pin >= 0 && pin < BOARD_NR_GPIO_PINS)
|
||||
#define GET_ARRAY_PIN(p) pin_t(pin_array[p].pin)
|
||||
#define pwm_status(pin) PWM_PIN(pin)
|
||||
#define digitalRead_mod(p) extDigitalRead(p)
|
||||
#define NAME_FORMAT(p) PSTR("%-##p##s")
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3hd "), int16_t(p)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PORT(p) print_port(p)
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define MULTI_NAME_PAD 20 // space needed to be pretty if not first name assigned to a pin
|
||||
|
||||
// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
|
||||
#ifndef M43_NEVER_TOUCH
|
||||
#define M43_NEVER_TOUCH(Q) (Q >= 9 && Q <= 12) // SERIAL/USB pins PA9(TX) PA10(RX)
|
||||
#endif
|
||||
|
||||
static inline int8_t get_pin_mode(pin_t pin) {
|
||||
return VALID_PIN(pin) ? _GET_MODE(pin) : -1;
|
||||
}
|
||||
|
||||
static inline pin_t DIGITAL_PIN_TO_ANALOG_PIN(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return -1;
|
||||
int8_t adc_channel = int8_t(PIN_MAP[pin].adc_channel);
|
||||
#ifdef NUM_ANALOG_INPUTS
|
||||
if (adc_channel >= NUM_ANALOG_INPUTS) adc_channel = ADCx;
|
||||
#endif
|
||||
return pin_t(adc_channel);
|
||||
}
|
||||
|
||||
static inline bool IS_ANALOG(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return false;
|
||||
if (PIN_MAP[pin].adc_channel != ADCx) {
|
||||
#ifdef NUM_ANALOG_INPUTS
|
||||
if (PIN_MAP[pin].adc_channel >= NUM_ANALOG_INPUTS) return false;
|
||||
#endif
|
||||
return _GET_MODE(pin) == GPIO_INPUT_ANALOG && !M43_NEVER_TOUCH(pin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool GET_PINMODE(const pin_t pin) {
|
||||
return VALID_PIN(pin) && !IS_INPUT(pin);
|
||||
}
|
||||
|
||||
static inline bool GET_ARRAY_IS_DIGITAL(const int16_t array_pin) {
|
||||
const pin_t pin = GET_ARRAY_PIN(array_pin);
|
||||
return (!IS_ANALOG(pin)
|
||||
#ifdef NUM_ANALOG_INPUTS
|
||||
|| PIN_MAP[pin].adc_channel >= NUM_ANALOG_INPUTS
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
static inline void pwm_details(const pin_t pin) {
|
||||
if (PWM_PIN(pin)) {
|
||||
timer_dev * const tdev = PIN_MAP[pin].timer_device;
|
||||
const uint8_t channel = PIN_MAP[pin].timer_channel;
|
||||
const char num = (
|
||||
#ifdef STM32_HIGH_DENSITY
|
||||
tdev == &timer8 ? '8' :
|
||||
tdev == &timer5 ? '5' :
|
||||
#endif
|
||||
tdev == &timer4 ? '4' :
|
||||
tdev == &timer3 ? '3' :
|
||||
tdev == &timer2 ? '2' :
|
||||
tdev == &timer1 ? '1' : '?'
|
||||
);
|
||||
char buffer[10];
|
||||
sprintf_P(buffer, PSTR(" TIM%c CH%c"), num, ('0' + channel));
|
||||
SERIAL_ECHO(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void print_port(pin_t pin) {
|
||||
const char port = 'A' + char(pin >> 4); // pin div 16
|
||||
/* seems not to be required for our devices
|
||||
gpio_dev * const gp = PIN_MAP[pin].gpio_device;
|
||||
const char port = (
|
||||
#if STM32_NR_GPIO_PORTS > 4
|
||||
gp == &gpiog ? 'G' :
|
||||
gp == &gpiof ? 'F' :
|
||||
gp == &gpioe ? 'E' :
|
||||
#endif
|
||||
gp == &gpiod ? 'D' :
|
||||
gp == &gpioc ? 'C' :
|
||||
gp == &gpiob ? 'B' :
|
||||
gp == &gpioa ? 'A' : '?'
|
||||
);
|
||||
*/
|
||||
const int16_t gbit = PIN_MAP[pin].gpio_bit;
|
||||
char buffer[6];
|
||||
sprintf_P(buffer, PSTR("P%c%hd "), port, gbit);
|
||||
if (gbit < 10) SERIAL_CHAR(' ');
|
||||
SERIAL_ECHO(buffer);
|
||||
}
|
||||
|
||||
#endif // BOARD_NR_GPIO_PINS
|
@ -0,0 +1,276 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#ifdef NUM_DIGITAL_PINS // Only in ST's Arduino core (STM32duino, STM32Core)
|
||||
|
||||
/**
|
||||
* Life gets complicated if you want an easy to use 'M43 I' output (in port/pin order)
|
||||
* because the variants in this platform do not always define all the I/O port/pins
|
||||
* that a CPU has.
|
||||
*
|
||||
* VARIABLES:
|
||||
* Ard_num - Arduino pin number - defined by the platform. It is used by digitalRead and
|
||||
* digitalWrite commands and by M42.
|
||||
* - does not contain port/pin info
|
||||
* - is not in port/pin order
|
||||
* - typically a variant will only assign Ard_num to port/pins that are actually used
|
||||
* Index - M43 counter - only used to get Ard_num
|
||||
* x - a parameter/argument used to search the pin_array to try to find a signal name
|
||||
* associated with a Ard_num
|
||||
* Port_pin - port number and pin number for use with CPU registers and printing reports
|
||||
*
|
||||
* Since M43 uses digitalRead and digitalWrite commands, only the Port_pins with an Ard_num
|
||||
* are accessed and/or displayed.
|
||||
*
|
||||
* Three arrays are used.
|
||||
*
|
||||
* digitalPin[] is provided by the platform. It consists of the Port_pin numbers in
|
||||
* Arduino pin number order.
|
||||
*
|
||||
* pin_array is a structure generated by the pins/pinsDebug.h header file. It is generated by
|
||||
* the preprocessor. Only the signals associated with enabled options are in this table.
|
||||
* It contains:
|
||||
* - name of the signal
|
||||
* - the Ard_num assigned by the pins_YOUR_BOARD.h file using the platform defines.
|
||||
* EXAMPLE: "#define KILL_PIN PB1" results in Ard_num of 57. 57 is then used as an
|
||||
* index into digitalPin[] to get the Port_pin number
|
||||
* - if it is a digital or analog signal. PWMs are considered digital here.
|
||||
*
|
||||
* pin_xref is a structure generated by this header file. It is generated by the
|
||||
* preprocessor. It is in port/pin order. It contains just the port/pin numbers defined by the
|
||||
* platform for this variant.
|
||||
* - Ard_num
|
||||
* - printable version of Port_pin
|
||||
*
|
||||
* Routines with an "x" as a parameter/argument are used to search the pin_array to try to
|
||||
* find a signal name associated with a port/pin.
|
||||
*
|
||||
* NOTE - the Arduino pin number is what is used by the M42 command, NOT the port/pin for that
|
||||
* signal. The Arduino pin number is listed by the M43 I command.
|
||||
*/
|
||||
|
||||
extern const PinName digitalPin[]; // provided by the platform
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// make a list of the Arduino pin numbers in the Port/Pin order
|
||||
//
|
||||
|
||||
#define _PIN_ADD_2(NAME_ALPHA, ARDUINO_NUM) { {NAME_ALPHA}, ARDUINO_NUM },
|
||||
#define _PIN_ADD(NAME_ALPHA, ARDUINO_NUM) { NAME_ALPHA, ARDUINO_NUM },
|
||||
#define PIN_ADD(NAME) _PIN_ADD(#NAME, NAME)
|
||||
|
||||
typedef struct {
|
||||
char Port_pin_alpha[5];
|
||||
pin_t Ard_num;
|
||||
} XrefInfo;
|
||||
|
||||
const XrefInfo pin_xref[] PROGMEM = {
|
||||
#include "pins_Xref.h"
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#define MODE_PIN_INPUT 0 // Input mode (reset state)
|
||||
#define MODE_PIN_OUTPUT 1 // General purpose output mode
|
||||
#define MODE_PIN_ALT 2 // Alternate function mode
|
||||
#define MODE_PIN_ANALOG 3 // Analog mode
|
||||
|
||||
#define PIN_NUM(P) (P & 0x000F)
|
||||
#define PIN_NUM_ALPHA_LEFT(P) (((P & 0x000F) < 10) ? ('0' + (P & 0x000F)) : '1')
|
||||
#define PIN_NUM_ALPHA_RIGHT(P) (((P & 0x000F) > 9) ? ('0' + (P & 0x000F) - 10) : 0 )
|
||||
#define PORT_NUM(P) ((P >> 4) & 0x0007)
|
||||
#define PORT_ALPHA(P) ('A' + (P >> 4))
|
||||
|
||||
/**
|
||||
* Translation of routines & variables used by pinsDebug.h
|
||||
*/
|
||||
#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS
|
||||
#define VALID_PIN(ANUM) ((ANUM) >= 0 && (ANUM) < NUMBER_PINS_TOTAL)
|
||||
#define digitalRead_mod(Ard_num) extDigitalRead(Ard_num) // must use Arduino pin numbers when doing reads
|
||||
#define NAME_FORMAT(p) PSTR("%-##p##s")
|
||||
#define PRINT_PIN(Q)
|
||||
#define PRINT_PORT(ANUM) port_print(ANUM)
|
||||
#define DIGITAL_PIN_TO_ANALOG_PIN(ANUM) -1 // will report analog pin number in the print port routine
|
||||
#define GET_PIN_MAP_PIN_M43(Index) pin_xref[Index].Ard_num
|
||||
|
||||
// x is a variable used to search pin_array
|
||||
#define GET_ARRAY_IS_DIGITAL(x) ((bool) pin_array[x].is_digital)
|
||||
#define GET_ARRAY_PIN(x) ((pin_t) pin_array[x].pin)
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define MULTI_NAME_PAD 33 // space needed to be pretty if not first name assigned to a pin
|
||||
|
||||
#ifndef M43_NEVER_TOUCH
|
||||
#define _M43_NEVER_TOUCH(Index) (Index >= 9 && Index <= 12) // SERIAL/USB pins: PA9(TX) PA10(RX) PA11(USB_DM) PA12(USB_DP)
|
||||
#ifdef KILL_PIN
|
||||
#define M43_NEVER_TOUCH(Index) m43_never_touch(Index)
|
||||
|
||||
bool m43_never_touch(const pin_t Index) {
|
||||
static pin_t M43_kill_index = -1;
|
||||
if (M43_kill_index < 0)
|
||||
for (M43_kill_index = 0; M43_kill_index < NUMBER_PINS_TOTAL; M43_kill_index++)
|
||||
if (KILL_PIN == GET_PIN_MAP_PIN_M43(M43_kill_index)) break;
|
||||
return _M43_NEVER_TOUCH(Index) || Index == M43_kill_index; // KILL_PIN and SERIAL/USB
|
||||
}
|
||||
#else
|
||||
#define M43_NEVER_TOUCH(Index) _M43_NEVER_TOUCH(Index)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint8_t get_pin_mode(const pin_t Ard_num) {
|
||||
uint32_t mode_all = 0;
|
||||
const PinName dp = digitalPin[Ard_num];
|
||||
switch (PORT_ALPHA(dp)) {
|
||||
case 'A' : mode_all = GPIOA->MODER; break;
|
||||
case 'B' : mode_all = GPIOB->MODER; break;
|
||||
case 'C' : mode_all = GPIOC->MODER; break;
|
||||
case 'D' : mode_all = GPIOD->MODER; break;
|
||||
#ifdef PE_0
|
||||
case 'E' : mode_all = GPIOE->MODER; break;
|
||||
#elif defined (PF_0)
|
||||
case 'F' : mode_all = GPIOF->MODER; break;
|
||||
#elif defined (PG_0)
|
||||
case 'G' : mode_all = GPIOG->MODER; break;
|
||||
#elif defined (PH_0)
|
||||
case 'H' : mode_all = GPIOH->MODER; break;
|
||||
#elif defined (PI_0)
|
||||
case 'I' : mode_all = GPIOI->MODER; break;
|
||||
#elif defined (PJ_0)
|
||||
case 'J' : mode_all = GPIOJ->MODER; break;
|
||||
#elif defined (PK_0)
|
||||
case 'K' : mode_all = GPIOK->MODER; break;
|
||||
#elif defined (PL_0)
|
||||
case 'L' : mode_all = GPIOL->MODER; break;
|
||||
#endif
|
||||
}
|
||||
return (mode_all >> (2 * uint8_t(PIN_NUM(dp)))) & 0x03;
|
||||
}
|
||||
|
||||
bool GET_PINMODE(const pin_t Ard_num) {
|
||||
const uint8_t pin_mode = get_pin_mode(Ard_num);
|
||||
return pin_mode == MODE_PIN_OUTPUT || pin_mode == MODE_PIN_ALT; // assume all alt definitions are PWM
|
||||
}
|
||||
|
||||
int8_t digital_pin_to_analog_pin(pin_t Ard_num) {
|
||||
Ard_num -= NUM_ANALOG_FIRST;
|
||||
return (Ard_num >= 0 && Ard_num < NUM_ANALOG_INPUTS) ? Ard_num : -1;
|
||||
}
|
||||
|
||||
bool IS_ANALOG(const pin_t Ard_num) {
|
||||
return get_pin_mode(Ard_num) == MODE_PIN_ANALOG;
|
||||
}
|
||||
|
||||
bool is_digital(const pin_t x) {
|
||||
const uint8_t pin_mode = get_pin_mode(pin_array[x].pin);
|
||||
return pin_mode == MODE_PIN_INPUT || pin_mode == MODE_PIN_OUTPUT;
|
||||
}
|
||||
|
||||
void port_print(const pin_t Ard_num) {
|
||||
char buffer[16];
|
||||
pin_t Index;
|
||||
for (Index = 0; Index < NUMBER_PINS_TOTAL; Index++)
|
||||
if (Ard_num == GET_PIN_MAP_PIN_M43(Index)) break;
|
||||
|
||||
char * const ppa = pin_xref[Index].Port_pin_alpha;
|
||||
sprintf_P(buffer, PSTR("%s"), ppa);
|
||||
SERIAL_ECHO(buffer);
|
||||
if (ppa[3] == '\0') SERIAL_CHAR(' ');
|
||||
|
||||
// print analog pin number
|
||||
const int8_t Port_pin = digital_pin_to_analog_pin(Ard_num);
|
||||
if (Port_pin >= 0) {
|
||||
sprintf_P(buffer, PSTR(" (A%d) "), Port_pin);
|
||||
SERIAL_ECHO(buffer);
|
||||
if (Port_pin < 10) SERIAL_CHAR(' ');
|
||||
}
|
||||
else
|
||||
SERIAL_ECHO_SP(7);
|
||||
|
||||
// Print number to be used with M42
|
||||
sprintf_P(buffer, PSTR(" M42 P%d "), Ard_num);
|
||||
SERIAL_ECHO(buffer);
|
||||
if (Ard_num < 10) SERIAL_CHAR(' ');
|
||||
if (Ard_num < 100) SERIAL_CHAR(' ');
|
||||
}
|
||||
|
||||
bool pwm_status(const pin_t Ard_num) {
|
||||
return get_pin_mode(Ard_num) == MODE_PIN_ALT;
|
||||
}
|
||||
|
||||
void pwm_details(const pin_t Ard_num) {
|
||||
if (pwm_status(Ard_num)) {
|
||||
uint32_t alt_all = 0;
|
||||
const PinName dp = digitalPin[Ard_num];
|
||||
pin_t pin_number = uint8_t(PIN_NUM(dp));
|
||||
const bool over_7 = pin_number >= 8;
|
||||
const uint8_t ind = over_7 ? 1 : 0;
|
||||
switch (PORT_ALPHA(dp)) { // get alt function
|
||||
case 'A' : alt_all = GPIOA->AFR[ind]; break;
|
||||
case 'B' : alt_all = GPIOB->AFR[ind]; break;
|
||||
case 'C' : alt_all = GPIOC->AFR[ind]; break;
|
||||
case 'D' : alt_all = GPIOD->AFR[ind]; break;
|
||||
#ifdef PE_0
|
||||
case 'E' : alt_all = GPIOE->AFR[ind]; break;
|
||||
#elif defined (PF_0)
|
||||
case 'F' : alt_all = GPIOF->AFR[ind]; break;
|
||||
#elif defined (PG_0)
|
||||
case 'G' : alt_all = GPIOG->AFR[ind]; break;
|
||||
#elif defined (PH_0)
|
||||
case 'H' : alt_all = GPIOH->AFR[ind]; break;
|
||||
#elif defined (PI_0)
|
||||
case 'I' : alt_all = GPIOI->AFR[ind]; break;
|
||||
#elif defined (PJ_0)
|
||||
case 'J' : alt_all = GPIOJ->AFR[ind]; break;
|
||||
#elif defined (PK_0)
|
||||
case 'K' : alt_all = GPIOK->AFR[ind]; break;
|
||||
#elif defined (PL_0)
|
||||
case 'L' : alt_all = GPIOL->AFR[ind]; break;
|
||||
#endif
|
||||
}
|
||||
if (over_7) pin_number -= 8;
|
||||
|
||||
uint8_t alt_func = (alt_all >> (4 * pin_number)) & 0x0F;
|
||||
SERIAL_ECHOPAIR("Alt Function: ", alt_func);
|
||||
if (alt_func < 10) SERIAL_CHAR(' ');
|
||||
SERIAL_ECHOPGM(" - ");
|
||||
switch (alt_func) {
|
||||
case 0 : SERIAL_ECHOPGM("system (misc. I/O)"); break;
|
||||
case 1 : SERIAL_ECHOPGM("TIM1/TIM2 (probably PWM)"); break;
|
||||
case 2 : SERIAL_ECHOPGM("TIM3..5 (probably PWM)"); break;
|
||||
case 3 : SERIAL_ECHOPGM("TIM8..11 (probably PWM)"); break;
|
||||
case 4 : SERIAL_ECHOPGM("I2C1..3"); break;
|
||||
case 5 : SERIAL_ECHOPGM("SPI1/SPI2"); break;
|
||||
case 6 : SERIAL_ECHOPGM("SPI3"); break;
|
||||
case 7 : SERIAL_ECHOPGM("USART1..3"); break;
|
||||
case 8 : SERIAL_ECHOPGM("USART4..6"); break;
|
||||
case 9 : SERIAL_ECHOPGM("CAN1/CAN2, TIM12..14 (probably PWM)"); break;
|
||||
case 10 : SERIAL_ECHOPGM("OTG"); break;
|
||||
case 11 : SERIAL_ECHOPGM("ETH"); break;
|
||||
case 12 : SERIAL_ECHOPGM("FSMC, SDIO, OTG"); break;
|
||||
case 13 : SERIAL_ECHOPGM("DCMI"); break;
|
||||
case 14 : SERIAL_ECHOPGM("unused (shouldn't see this)"); break;
|
||||
case 15 : SERIAL_ECHOPGM("EVENTOUT"); break;
|
||||
}
|
||||
}
|
||||
} // pwm_details
|
||||
|
||||
#endif // NUM_DIGITAL_PINS
|
@ -0,0 +1,612 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
//
|
||||
// make a list of the Arduino pin numbers in the Port/Pin order
|
||||
//
|
||||
#ifdef PA0
|
||||
PIN_ADD(PA0)
|
||||
#endif
|
||||
#ifdef PA1
|
||||
PIN_ADD(PA1)
|
||||
#endif
|
||||
#ifdef PA2
|
||||
PIN_ADD(PA2)
|
||||
#endif
|
||||
#ifdef PA3
|
||||
PIN_ADD(PA3)
|
||||
#endif
|
||||
#ifdef PA4
|
||||
PIN_ADD(PA4)
|
||||
#endif
|
||||
#ifdef PA5
|
||||
PIN_ADD(PA5)
|
||||
#endif
|
||||
#ifdef PA6
|
||||
PIN_ADD(PA6)
|
||||
#endif
|
||||
#ifdef PA7
|
||||
PIN_ADD(PA7)
|
||||
#endif
|
||||
#ifdef PA8
|
||||
PIN_ADD(PA8)
|
||||
#endif
|
||||
#ifdef PA9
|
||||
PIN_ADD(PA9)
|
||||
#endif
|
||||
#ifdef PA10
|
||||
PIN_ADD(PA10)
|
||||
#endif
|
||||
#ifdef PA11
|
||||
PIN_ADD(PA11)
|
||||
#endif
|
||||
#ifdef PA12
|
||||
PIN_ADD(PA12)
|
||||
#endif
|
||||
#ifdef PA13
|
||||
PIN_ADD(PA13)
|
||||
#endif
|
||||
#ifdef PA14
|
||||
PIN_ADD(PA14)
|
||||
#endif
|
||||
#ifdef PA15
|
||||
PIN_ADD(PA15)
|
||||
#endif
|
||||
|
||||
#ifdef PB0
|
||||
PIN_ADD(PB0)
|
||||
#endif
|
||||
#ifdef PB1
|
||||
PIN_ADD(PB1)
|
||||
#endif
|
||||
#ifdef PB2
|
||||
PIN_ADD(PB2)
|
||||
#endif
|
||||
#ifdef PB3
|
||||
PIN_ADD(PB3)
|
||||
#endif
|
||||
#ifdef PB4
|
||||
PIN_ADD(PB4)
|
||||
#endif
|
||||
#ifdef PB5
|
||||
PIN_ADD(PB5)
|
||||
#endif
|
||||
#ifdef PB6
|
||||
PIN_ADD(PB6)
|
||||
#endif
|
||||
#ifdef PB7
|
||||
PIN_ADD(PB7)
|
||||
#endif
|
||||
#ifdef PB8
|
||||
PIN_ADD(PB8)
|
||||
#endif
|
||||
#ifdef PB9
|
||||
PIN_ADD(PB9)
|
||||
#endif
|
||||
#ifdef PB10
|
||||
PIN_ADD(PB10)
|
||||
#endif
|
||||
#ifdef PB11
|
||||
PIN_ADD(PB11)
|
||||
#endif
|
||||
#ifdef PB12
|
||||
PIN_ADD(PB12)
|
||||
#endif
|
||||
#ifdef PB13
|
||||
PIN_ADD(PB13)
|
||||
#endif
|
||||
#ifdef PB14
|
||||
PIN_ADD(PB14)
|
||||
#endif
|
||||
#ifdef PB15
|
||||
PIN_ADD(PB15)
|
||||
#endif
|
||||
|
||||
#ifdef PC0
|
||||
PIN_ADD(PC0)
|
||||
#endif
|
||||
#ifdef PC1
|
||||
PIN_ADD(PC1)
|
||||
#endif
|
||||
#ifdef PC2
|
||||
PIN_ADD(PC2)
|
||||
#endif
|
||||
#ifdef PC3
|
||||
PIN_ADD(PC3)
|
||||
#endif
|
||||
#ifdef PC4
|
||||
PIN_ADD(PC4)
|
||||
#endif
|
||||
#ifdef PC5
|
||||
PIN_ADD(PC5)
|
||||
#endif
|
||||
#ifdef PC6
|
||||
PIN_ADD(PC6)
|
||||
#endif
|
||||
#ifdef PC7
|
||||
PIN_ADD(PC7)
|
||||
#endif
|
||||
#ifdef PC8
|
||||
PIN_ADD(PC8)
|
||||
#endif
|
||||
#ifdef PC9
|
||||
PIN_ADD(PC9)
|
||||
#endif
|
||||
#ifdef PC10
|
||||
PIN_ADD(PC10)
|
||||
#endif
|
||||
#ifdef PC11
|
||||
PIN_ADD(PC11)
|
||||
#endif
|
||||
#ifdef PC12
|
||||
PIN_ADD(PC12)
|
||||
#endif
|
||||
#ifdef PC13
|
||||
PIN_ADD(PC13)
|
||||
#endif
|
||||
#ifdef PC14
|
||||
PIN_ADD(PC14)
|
||||
#endif
|
||||
#ifdef PC15
|
||||
PIN_ADD(PC15)
|
||||
#endif
|
||||
|
||||
#ifdef PD0
|
||||
PIN_ADD(PD0)
|
||||
#endif
|
||||
#ifdef PD1
|
||||
PIN_ADD(PD1)
|
||||
#endif
|
||||
#ifdef PD2
|
||||
PIN_ADD(PD2)
|
||||
#endif
|
||||
#ifdef PD3
|
||||
PIN_ADD(PD3)
|
||||
#endif
|
||||
#ifdef PD4
|
||||
PIN_ADD(PD4)
|
||||
#endif
|
||||
#ifdef PD5
|
||||
PIN_ADD(PD5)
|
||||
#endif
|
||||
#ifdef PD6
|
||||
PIN_ADD(PD6)
|
||||
#endif
|
||||
#ifdef PD7
|
||||
PIN_ADD(PD7)
|
||||
#endif
|
||||
#ifdef PD8
|
||||
PIN_ADD(PD8)
|
||||
#endif
|
||||
#ifdef PD9
|
||||
PIN_ADD(PD9)
|
||||
#endif
|
||||
#ifdef PD10
|
||||
PIN_ADD(PD10)
|
||||
#endif
|
||||
#ifdef PD11
|
||||
PIN_ADD(PD11)
|
||||
#endif
|
||||
#ifdef PD12
|
||||
PIN_ADD(PD12)
|
||||
#endif
|
||||
#ifdef PD13
|
||||
PIN_ADD(PD13)
|
||||
#endif
|
||||
#ifdef PD14
|
||||
PIN_ADD(PD14)
|
||||
#endif
|
||||
#ifdef PD15
|
||||
PIN_ADD(PD15)
|
||||
#endif
|
||||
|
||||
#ifdef PE0
|
||||
PIN_ADD(PE0)
|
||||
#endif
|
||||
#ifdef PE1
|
||||
PIN_ADD(PE1)
|
||||
#endif
|
||||
#ifdef PE2
|
||||
PIN_ADD(PE2)
|
||||
#endif
|
||||
#ifdef PE3
|
||||
PIN_ADD(PE3)
|
||||
#endif
|
||||
#ifdef PE4
|
||||
PIN_ADD(PE4)
|
||||
#endif
|
||||
#ifdef PE5
|
||||
PIN_ADD(PE5)
|
||||
#endif
|
||||
#ifdef PE6
|
||||
PIN_ADD(PE6)
|
||||
#endif
|
||||
#ifdef PE7
|
||||
PIN_ADD(PE7)
|
||||
#endif
|
||||
#ifdef PE8
|
||||
PIN_ADD(PE8)
|
||||
#endif
|
||||
#ifdef PE9
|
||||
PIN_ADD(PE9)
|
||||
#endif
|
||||
#ifdef PE10
|
||||
PIN_ADD(PE10)
|
||||
#endif
|
||||
#ifdef PE11
|
||||
PIN_ADD(PE11)
|
||||
#endif
|
||||
#ifdef PE12
|
||||
PIN_ADD(PE12)
|
||||
#endif
|
||||
#ifdef PE13
|
||||
PIN_ADD(PE13)
|
||||
#endif
|
||||
#ifdef PE14
|
||||
PIN_ADD(PE14)
|
||||
#endif
|
||||
#ifdef PE15
|
||||
PIN_ADD(PE15)
|
||||
#endif
|
||||
|
||||
#ifdef PF0
|
||||
PIN_ADD(PF0)
|
||||
#endif
|
||||
#ifdef PF1
|
||||
PIN_ADD(PF1)
|
||||
#endif
|
||||
#ifdef PF2
|
||||
PIN_ADD(PF2)
|
||||
#endif
|
||||
#ifdef PF3
|
||||
PIN_ADD(PF3)
|
||||
#endif
|
||||
#ifdef PF4
|
||||
PIN_ADD(PF4)
|
||||
#endif
|
||||
#ifdef PF5
|
||||
PIN_ADD(PF5)
|
||||
#endif
|
||||
#ifdef PF6
|
||||
PIN_ADD(PF6)
|
||||
#endif
|
||||
#ifdef PF7
|
||||
PIN_ADD(PF7)
|
||||
#endif
|
||||
#ifdef PF8
|
||||
PIN_ADD(PF8)
|
||||
#endif
|
||||
#ifdef PF9
|
||||
PIN_ADD(PF9)
|
||||
#endif
|
||||
#ifdef PF10
|
||||
PIN_ADD(PF10)
|
||||
#endif
|
||||
#ifdef PF11
|
||||
PIN_ADD(PF11)
|
||||
#endif
|
||||
#ifdef PF12
|
||||
PIN_ADD(PF12)
|
||||
#endif
|
||||
#ifdef PF13
|
||||
PIN_ADD(PF13)
|
||||
#endif
|
||||
#ifdef PF14
|
||||
PIN_ADD(PF14)
|
||||
#endif
|
||||
#ifdef PF15
|
||||
PIN_ADD(PF15)
|
||||
#endif
|
||||
|
||||
#ifdef PG0
|
||||
PIN_ADD(PG0)
|
||||
#endif
|
||||
#ifdef PG1
|
||||
PIN_ADD(PG1)
|
||||
#endif
|
||||
#ifdef PG2
|
||||
PIN_ADD(PG2)
|
||||
#endif
|
||||
#ifdef PG3
|
||||
PIN_ADD(PG3)
|
||||
#endif
|
||||
#ifdef PG4
|
||||
PIN_ADD(PG4)
|
||||
#endif
|
||||
#ifdef PG5
|
||||
PIN_ADD(PG5)
|
||||
#endif
|
||||
#ifdef PG6
|
||||
PIN_ADD(PG6)
|
||||
#endif
|
||||
#ifdef PG7
|
||||
PIN_ADD(PG7)
|
||||
#endif
|
||||
#ifdef PG8
|
||||
PIN_ADD(PG8)
|
||||
#endif
|
||||
#ifdef PG9
|
||||
PIN_ADD(PG9)
|
||||
#endif
|
||||
#ifdef PG10
|
||||
PIN_ADD(PG10)
|
||||
#endif
|
||||
#ifdef PG11
|
||||
PIN_ADD(PG11)
|
||||
#endif
|
||||
#ifdef PG12
|
||||
PIN_ADD(PG12)
|
||||
#endif
|
||||
#ifdef PG13
|
||||
PIN_ADD(PG13)
|
||||
#endif
|
||||
#ifdef PG14
|
||||
PIN_ADD(PG14)
|
||||
#endif
|
||||
#ifdef PG15
|
||||
PIN_ADD(PG15)
|
||||
#endif
|
||||
|
||||
#ifdef PH0
|
||||
PIN_ADD(PH0)
|
||||
#endif
|
||||
#ifdef PH1
|
||||
PIN_ADD(PH1)
|
||||
#endif
|
||||
#ifdef PH2
|
||||
PIN_ADD(PH2)
|
||||
#endif
|
||||
#ifdef PH3
|
||||
PIN_ADD(PH3)
|
||||
#endif
|
||||
#ifdef PH4
|
||||
PIN_ADD(PH4)
|
||||
#endif
|
||||
#ifdef PH5
|
||||
PIN_ADD(PH5)
|
||||
#endif
|
||||
#ifdef PH6
|
||||
PIN_ADD(PH6)
|
||||
#endif
|
||||
#ifdef PH7
|
||||
PIN_ADD(PH7)
|
||||
#endif
|
||||
#ifdef PH8
|
||||
PIN_ADD(PH8)
|
||||
#endif
|
||||
#ifdef PH9
|
||||
PIN_ADD(PH9)
|
||||
#endif
|
||||
#ifdef PH10
|
||||
PIN_ADD(PH10)
|
||||
#endif
|
||||
#ifdef PH11
|
||||
PIN_ADD(PH11)
|
||||
#endif
|
||||
#ifdef PH12
|
||||
PIN_ADD(PH12)
|
||||
#endif
|
||||
#ifdef PH13
|
||||
PIN_ADD(PH13)
|
||||
#endif
|
||||
#ifdef PH14
|
||||
PIN_ADD(PH14)
|
||||
#endif
|
||||
#ifdef PH15
|
||||
PIN_ADD(PH15)
|
||||
#endif
|
||||
|
||||
#ifdef PI0
|
||||
PIN_ADD(PI0)
|
||||
#endif
|
||||
#ifdef PI1
|
||||
PIN_ADD(PI1)
|
||||
#endif
|
||||
#ifdef PI2
|
||||
PIN_ADD(PI2)
|
||||
#endif
|
||||
#ifdef PI3
|
||||
PIN_ADD(PI3)
|
||||
#endif
|
||||
#ifdef PI4
|
||||
PIN_ADD(PI4)
|
||||
#endif
|
||||
#ifdef PI5
|
||||
PIN_ADD(PI5)
|
||||
#endif
|
||||
#ifdef PI6
|
||||
PIN_ADD(PI6)
|
||||
#endif
|
||||
#ifdef PI7
|
||||
PIN_ADD(PI7)
|
||||
#endif
|
||||
#ifdef PI8
|
||||
PIN_ADD(PI8)
|
||||
#endif
|
||||
#ifdef PI9
|
||||
PIN_ADD(PI9)
|
||||
#endif
|
||||
#ifdef PI10
|
||||
PIN_ADD(PI10)
|
||||
#endif
|
||||
#ifdef PI11
|
||||
PIN_ADD(PI11)
|
||||
#endif
|
||||
#ifdef PI12
|
||||
PIN_ADD(PI12)
|
||||
#endif
|
||||
#ifdef PI13
|
||||
PIN_ADD(PI13)
|
||||
#endif
|
||||
#ifdef PI14
|
||||
PIN_ADD(PI14)
|
||||
#endif
|
||||
#ifdef PI15
|
||||
PIN_ADD(PI15)
|
||||
#endif
|
||||
|
||||
#ifdef PJ0
|
||||
PIN_ADD(PJ0)
|
||||
#endif
|
||||
#ifdef PJ1
|
||||
PIN_ADD(PJ1)
|
||||
#endif
|
||||
#ifdef PJ2
|
||||
PIN_ADD(PJ2)
|
||||
#endif
|
||||
#ifdef PJ3
|
||||
PIN_ADD(PJ3)
|
||||
#endif
|
||||
#ifdef PJ4
|
||||
PIN_ADD(PJ4)
|
||||
#endif
|
||||
#ifdef PJ5
|
||||
PIN_ADD(PJ5)
|
||||
#endif
|
||||
#ifdef PJ6
|
||||
PIN_ADD(PJ6)
|
||||
#endif
|
||||
#ifdef PJ7
|
||||
PIN_ADD(PJ7)
|
||||
#endif
|
||||
#ifdef PJ8
|
||||
PIN_ADD(PJ8)
|
||||
#endif
|
||||
#ifdef PJ9
|
||||
PIN_ADD(PJ9)
|
||||
#endif
|
||||
#ifdef PJ10
|
||||
PIN_ADD(PJ10)
|
||||
#endif
|
||||
#ifdef PJ11
|
||||
PIN_ADD(PJ11)
|
||||
#endif
|
||||
#ifdef PJ12
|
||||
PIN_ADD(PJ12)
|
||||
#endif
|
||||
#ifdef PJ13
|
||||
PIN_ADD(PJ13)
|
||||
#endif
|
||||
#ifdef PJ14
|
||||
PIN_ADD(PJ14)
|
||||
#endif
|
||||
#ifdef PJ15
|
||||
PIN_ADD(PJ15)
|
||||
#endif
|
||||
|
||||
#ifdef PK0
|
||||
PIN_ADD(PK0)
|
||||
#endif
|
||||
#ifdef PK1
|
||||
PIN_ADD(PK1)
|
||||
#endif
|
||||
#ifdef PK2
|
||||
PIN_ADD(PK2)
|
||||
#endif
|
||||
#ifdef PK3
|
||||
PIN_ADD(PK3)
|
||||
#endif
|
||||
#ifdef PK4
|
||||
PIN_ADD(PK4)
|
||||
#endif
|
||||
#ifdef PK5
|
||||
PIN_ADD(PK5)
|
||||
#endif
|
||||
#ifdef PK6
|
||||
PIN_ADD(PK6)
|
||||
#endif
|
||||
#ifdef PK7
|
||||
PIN_ADD(PK7)
|
||||
#endif
|
||||
#ifdef PK8
|
||||
PIN_ADD(PK8)
|
||||
#endif
|
||||
#ifdef PK9
|
||||
PIN_ADD(PK9)
|
||||
#endif
|
||||
#ifdef PK10
|
||||
PIN_ADD(PK10)
|
||||
#endif
|
||||
#ifdef PK11
|
||||
PIN_ADD(PK11)
|
||||
#endif
|
||||
#ifdef PK12
|
||||
PIN_ADD(PK12)
|
||||
#endif
|
||||
#ifdef PK13
|
||||
PIN_ADD(PK13)
|
||||
#endif
|
||||
#ifdef PK14
|
||||
PIN_ADD(PK14)
|
||||
#endif
|
||||
#ifdef PK15
|
||||
PIN_ADD(PK15)
|
||||
#endif
|
||||
|
||||
#ifdef PL0
|
||||
PIN_ADD(PL0)
|
||||
#endif
|
||||
#ifdef PL1
|
||||
PIN_ADD(PL1)
|
||||
#endif
|
||||
#ifdef PL2
|
||||
PIN_ADD(PL2)
|
||||
#endif
|
||||
#ifdef PL3
|
||||
PIN_ADD(PL3)
|
||||
#endif
|
||||
#ifdef PL4
|
||||
PIN_ADD(PL4)
|
||||
#endif
|
||||
#ifdef PL5
|
||||
PIN_ADD(PL5)
|
||||
#endif
|
||||
#ifdef PL6
|
||||
PIN_ADD(PL6)
|
||||
#endif
|
||||
#ifdef PL7
|
||||
PIN_ADD(PL7)
|
||||
#endif
|
||||
#ifdef PL8
|
||||
PIN_ADD(PL8)
|
||||
#endif
|
||||
#ifdef PL9
|
||||
PIN_ADD(PL9)
|
||||
#endif
|
||||
#ifdef PL10
|
||||
PIN_ADD(PL10)
|
||||
#endif
|
||||
#ifdef PL11
|
||||
PIN_ADD(PL11)
|
||||
#endif
|
||||
#ifdef PL12
|
||||
PIN_ADD(PL12)
|
||||
#endif
|
||||
#ifdef PL13
|
||||
PIN_ADD(PL13)
|
||||
#endif
|
||||
#ifdef PL14
|
||||
PIN_ADD(PL14)
|
||||
#endif
|
||||
#ifdef PL15
|
||||
PIN_ADD(PL15)
|
||||
#endif
|
@ -1 +1,27 @@
|
||||
#error Debug pins is not supported on this Platform!
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef NUM_DIGITAL_PINS // Only in ST's Arduino core (STM32duino, STM32Core)
|
||||
#include "../HAL_STM32/pinsDebug_STM32duino.h"
|
||||
#elif defined(BOARD_NR_GPIO_PINS) // Only in STM32GENERIC (Maple)
|
||||
#include "../HAL_STM32/pinsDebug_STM32GENERIC.h"
|
||||
#else
|
||||
#error "M43 not supported for this board"
|
||||
#endif
|
||||
|
@ -1 +1,27 @@
|
||||
#error Debug pins is not supported on this Platform!
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef NUM_DIGITAL_PINS // Only in ST's Arduino core (STM32duino, STM32Core)
|
||||
#include "../HAL_STM32/pinsDebug_STM32duino.h"
|
||||
#elif defined(BOARD_NR_GPIO_PINS) // Only in STM32GENERIC (Maple)
|
||||
#include "../HAL_STM32/pinsDebug_STM32GENERIC.h"
|
||||
#else
|
||||
#error "M43 not supported for this board"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue