diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-01-10 21:31:55 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-01-10 21:31:55 +0300 |
commit | e39e8495e049610f7f1b0f6b7b84a2c264c18b85 (patch) | |
tree | 910bdee07485d847df7e8ca3c1ec7659534e1644 /src | |
parent | bb765cf76647399b61547d500f71be13ec8ab8a7 (diff) |
Simplified build configuration files and added Duet3_MB6XD
Diffstat (limited to 'src')
29 files changed, 473 insertions, 329 deletions
diff --git a/src/Configuration.h b/src/Config/Configuration.h index 08f43752..08f43752 100644 --- a/src/Configuration.h +++ b/src/Config/Configuration.h diff --git a/src/Pccb/Pins_Pccb.cpp b/src/Config/Pins.cpp index 5fa45a32..d37dc569 100644 --- a/src/Pccb/Pins_Pccb.cpp +++ b/src/Config/Pins.cpp @@ -1,5 +1,5 @@ /* - * Pins_DuetNG.cpp + * Pins.cpp * * Created on: 31 Mar 2019 * Author: David @@ -7,9 +7,9 @@ #include "RepRapFirmware.h" -// Hardware-dependent pins functions +// Pins lookup functions, possibly hardware-dependent -// Return a pointer to the pin description entry. Declared in and called from CoreN2G. +// Return a pointer to the pin description entry. Declared in and called from CoreN2G. Return nullptr if the pin number is out of range. const PinDescriptionBase *AppGetPinDescription(Pin p) noexcept { return (p < ARRAY_SIZE(PinTable)) ? &PinTable[p] : nullptr; diff --git a/src/Pins.h b/src/Config/Pins.h index d52cf223..3646403b 100644 --- a/src/Pins.h +++ b/src/Config/Pins.h @@ -6,9 +6,12 @@ #if !defined(PLATFORM) # if defined(__SAM4E8E__) # define PLATFORM DuetNG -# elif defined(__SAME70Q20B__) || defined(__SAME70Q21B__) -# if defined(DUET3_V06) -# define PLATFORM Duet3_V06 +# elif defined(__SAME70Q20B__) || defined(__SAME70Q21B__) || defined(__SAMV71Q20B__) +# if defined(DUET3_MB6HC) +# define PLATFORM Duet3_MB6HC +# define DUET3 1 +# elif defined(DUET3_MB6XD) +# define PLATFORM Duet3_MB6XD # define DUET3 1 # else # error Unknown platform @@ -32,7 +35,7 @@ # define P_CONCAT(x,y) P_EXPAND(x)y # define P_STR(x) #x # define P_XSTR(x) P_STR(x) -# define P_INCLUDE_FILE P_XSTR(P_CONCAT(PLATFORM,P_CONCAT(/Pins_,P_CONCAT(PLATFORM,.h)))) +# define P_INCLUDE_FILE P_XSTR(P_CONCAT(Pins_,P_CONCAT(PLATFORM,.h))) #endif #include P_INCLUDE_FILE diff --git a/src/Duet3Mini/Pins_Duet3Mini.h b/src/Config/Pins_Duet3Mini.h index 32f4aa38..32f4aa38 100644 --- a/src/Duet3Mini/Pins_Duet3Mini.h +++ b/src/Config/Pins_Duet3Mini.h diff --git a/src/Duet3_V06/Pins_Duet3_V06.h b/src/Config/Pins_Duet3_MB6HC.h index 741df19e..7ca8a7ba 100644 --- a/src/Duet3_V06/Pins_Duet3_V06.h +++ b/src/Config/Pins_Duet3_MB6HC.h @@ -1,5 +1,5 @@ -#ifndef PINS_DUET3_V06_H__ -#define PINS_DUET3_V06_H__ +#ifndef PINS_DUET3_MB6HC_H__ +#define PINS_DUET3_MB6HC_H__ #include <PinDescription.h> @@ -436,4 +436,4 @@ namespace StepPins } } -#endif +#endif //ifndef PINS_DUET3_MB6HC_H__ diff --git a/src/Config/Pins_Duet3_MB6XD.h b/src/Config/Pins_Duet3_MB6XD.h new file mode 100644 index 00000000..933ad492 --- /dev/null +++ b/src/Config/Pins_Duet3_MB6XD.h @@ -0,0 +1,439 @@ +#ifndef PINS_DUET3_MB6XD_H__ +#define PINS_DUET3_MB6XD_H__ + +#include <PinDescription.h> + +#define BOARD_SHORT_NAME "MB6HC" +#define BOARD_NAME "Duet 3 MB6HC" +#define DEFAULT_BOARD_TYPE BoardType::Auto +#define FIRMWARE_NAME "RepRapFirmware for Duet 3 MB6HC" +#define IAP_FIRMWARE_FILE "Duet3Firmware_" BOARD_SHORT_NAME ".bin" + +#define IAP_UPDATE_FILE "Duet3_SDiap32_" BOARD_SHORT_NAME ".bin" +#define IAP_UPDATE_FILE_SBC "Duet3_SBCiap32_" BOARD_SHORT_NAME ".bin" +constexpr uint32_t IAP_IMAGE_START = 0x20458000; // last 32kb of RAM + +// Features definition +#define HAS_LWIP_NETWORKING 1 +#define HAS_WIFI_NETWORKING 0 +#define HAS_SBC_INTERFACE 1 + +#define HAS_MASS_STORAGE 1 +#define HAS_HIGH_SPEED_SD 1 +#define HAS_CPU_TEMP_SENSOR 1 + +#define SUPPORT_TMC51xx 1 +#define TMC51xx_USES_USART 1 + +#define HAS_VOLTAGE_MONITOR 1 +#define ENFORCE_MAX_VIN 0 +#define HAS_12V_MONITOR 1 +#define ENFORCE_MIN_V12 1 +#define HAS_VREF_MONITOR 1 + +#define SUPPORT_CAN_EXPANSION 1 +#define DUAL_CAN 1 // support the second CAN interface as simple CAN (not FD) +#define SUPPORT_LED_STRIPS 1 +#define SUPPORT_INKJET 0 // set nonzero to support inkjet control +#define SUPPORT_ROLAND 0 // set nonzero to support Roland mill +#define SUPPORT_SCANNER 0 // set zero to disable support for FreeLSS scanners +#define SUPPORT_LASER 1 // support laser cutters and engravers using G1 S parameter +#define SUPPORT_IOBITS 1 // set to support P parameter in G0/G1 commands +#define SUPPORT_DHT_SENSOR 1 // set nonzero to support DHT temperature/humidity sensors +#define SUPPORT_ACCELEROMETERS 1 +#define SUPPORT_WORKPLACE_COORDINATES 1 // set nonzero to support G10 L2 and G53..59 +#define SUPPORT_OBJECT_MODEL 1 +#define SUPPORT_FTP 1 +#define SUPPORT_TELNET 1 +#define SUPPORT_ASYNC_MOVES 1 +#define ALLOCATE_DEFAULT_PORTS 0 +#define TRACK_OBJECT_NAMES 1 + +#define USE_MPU 1 // Needed if USE_CACHE is set, so that we can have non-cacheable memory regions +#define USE_CACHE 1 + +// The physical capabilities of the machine + +#include <Duet3Common.h> // this file is in the CANlib project because both main and expansion boards need it + +constexpr size_t NumDirectDrivers = 6; // The maximum number of drives supported by the electronics inc. direct expansion +constexpr size_t MaxSmartDrivers = 6; // The maximum number of direct smart drivers +constexpr size_t MaxCanDrivers = 20; +constexpr size_t MaxCanBoards = 20; + +constexpr float MaxTmc5160Current = 6300.0; // The maximum current we allow the TMC5160/5161 drivers to be set to +constexpr float Tmc5160SenseResistor = 0.050; + +constexpr size_t MaxPortsPerHeater = 3; + +constexpr size_t MaxBedHeaters = 12; +constexpr size_t MaxChamberHeaters = 4; +constexpr int8_t DefaultE0Heater = 1; // Index of the default first extruder heater, used only for the legacy status response + +constexpr size_t NumThermistorInputs = 4; +constexpr size_t NumTmcDriversSenseChannels = 1; + +constexpr size_t MinAxes = 3; // The minimum and default number of axes +constexpr size_t MaxAxes = 15; // The maximum number of movement axes in the machine +constexpr size_t MaxDriversPerAxis = 8; // The maximum number of stepper drivers assigned to one axis + +constexpr size_t MaxExtruders = 16; // The maximum number of extruders +constexpr size_t MaxAxesPlusExtruders = 25; // May be <= MaxAxes + MaxExtruders + +constexpr size_t MaxHeatersPerTool = 8; +constexpr size_t MaxExtrudersPerTool = 8; + +constexpr unsigned int MaxTriggers = 32; // Must be <= 32 because we store a bitmap of pending triggers in a uint32_t + +constexpr size_t NumSerialChannels = 3; // The number of serial IO channels not counting the WiFi serial connection (USB and one auxiliary UART) +#define SERIAL_MAIN_DEVICE SerialUSB +#define SERIAL_AUX_DEVICE Serial +#define SERIAL_AUX2_DEVICE Serial1 + +// Shared SPI (USART 1) +constexpr Pin APIN_USART_SSPI_SCK = PortBPin(13); +constexpr GpioPinFunction USARTSPIMosiPeriphMode = GpioPinFunction::C; +constexpr Pin APIN_USART_SSPI_MOSI = PortBPin(1); +constexpr GpioPinFunction USARTSPIMisoPeriphMode = GpioPinFunction::C; +constexpr Pin APIN_USART_SSPI_MISO = PortBPin(0); +constexpr GpioPinFunction USARTSPISckPeriphMode = GpioPinFunction::C; + +constexpr Pin UsbVBusPin = PortCPin(21); // Pin used to monitor VBUS on USB port + +// Drivers +constexpr Pin STEP_PINS[NumDirectDrivers] = { PortCPin(18), PortCPin(16), PortCPin(28), PortCPin(01), PortCPin(04), PortCPin(9) }; +constexpr Pin DIRECTION_PINS[NumDirectDrivers] = { PortBPin(05), PortDPin(10), PortAPin(04), PortAPin(22), PortCPin(03), PortDPin(14) }; +constexpr Pin DIAG_PINS[NumDirectDrivers] = { PortDPin(29), PortCPin(17), PortDPin(13), PortCPin(02), PortDPin(31), PortCPin(10) }; + +// Pin assignments etc. using USART1 in SPI mode +constexpr Pin GlobalTmc51xxEnablePin = PortAPin(9); // The pin that drives ENN of all TMC drivers +constexpr Pin GlobalTmc51xxCSPin = PortDPin(17); // The pin that drives CS of all TMC drivers +Usart * const USART_TMC51xx = USART1; +constexpr uint32_t ID_TMC51xx_SPI = ID_USART1; +constexpr IRQn TMC51xx_SPI_IRQn = USART1_IRQn; +#define TMC51xx_SPI_Handler USART1_Handler + +// These next two are #defines to avoid the need to #include DmacManager.h here +#define TMC51xx_DmaTxPerid ((uint32_t)DmaTrigSource::usart1tx) +#define TMC51xx_DmaRxPerid ((uint32_t)DmaTrigSource::usart1rx) + +constexpr Pin TMC51xxMosiPin = PortBPin(4); +constexpr GpioPinFunction TMC51xxMosiPinPeriphMode = GpioPinFunction::D; +constexpr Pin TMC51xxMisoPin = PortAPin(21); +constexpr GpioPinFunction TMC51xxMisoPinPeriphMode = GpioPinFunction::A; +constexpr Pin TMC51xxSclkPin = PortAPin(23); +constexpr GpioPinFunction TMC51xxSclkPinPeriphMode = GpioPinFunction::A; + +constexpr uint32_t DefaultStandstillCurrentPercent = 71; + +// Thermistor/PT1000 inputs +constexpr Pin TEMP_SENSE_PINS[NumThermistorInputs] = { PortCPin(15), PortCPin(29), PortCPin(30), PortCPin(31) }; // Thermistor/PT1000 pins +constexpr Pin VssaSensePin = PortCPin(13); +constexpr Pin VrefSensePin = PortCPin(0); + +// Thermistor series resistor value in Ohms +constexpr float DefaultThermistorSeriesR = 2200.0; +constexpr float MinVrefLoadR = (DefaultThermistorSeriesR / NumThermistorInputs) * 4700.0/((DefaultThermistorSeriesR / NumThermistorInputs) + 4700.0); + // there are 4 temperature sensing channels and a 4K7 load resistor +constexpr float VrefSeriesR = 15.0; + +// Digital pins the SPI temperature sensors have their select lines tied to +constexpr Pin SpiTempSensorCsPins[] = { PortAPin(5), PortAPin(6), PortDPin(20), PortCPin(22) }; + +// Analogue pin numbers +constexpr Pin PowerMonitorVinDetectPin = PortAPin(20); +constexpr Pin PowerMonitorV12DetectPin = PortEPin(4); +constexpr float PowerMonitorVoltageRange = (60.4 + 4.7)/4.7 * 3.3; // voltage divider ratio times the reference voltage +constexpr float V12MonitorVoltageRange = (60.4 + 4.7)/4.7 * 3.3; // voltage divider ratio times the reference voltage + +// Digital pin number to turn the IR LED on (high) or off (low), also controls the DIAG LED +constexpr Pin DiagPin = PortCPin(20); +constexpr bool DiagOnPolarity = true; + +// SD cards +constexpr size_t NumSdCards = 2; // we now allow one SPI-connected SD card to be configured at boot time +constexpr Pin SdCardDetectPins[NumSdCards] = { PortAPin(29), NoPin }; +constexpr Pin SdWriteProtectPins[NumSdCards] = { NoPin, NoPin }; +constexpr Pin SdSpiCSPins[NumSdCards] = { NoPin, NoPin }; +constexpr uint32_t ExpectedSdCardSpeed = 25000000; +constexpr IRQn SdhcIRQn = HSMCI_IRQn; + +// DotStar LED control +#define LEDSTRIP_USES_USART 0 + +constexpr Pin DotStarMosiPin = PortAPin(13); +constexpr Pin DotStarSclkPin = PortAPin(14); +constexpr GpioPinFunction DotStarPinMode = GpioPinFunction::A; +constexpr uint32_t DotStarClockId = ID_QSPI; +constexpr IRQn DotStarIRQn = QSPI_IRQn; + +// Ethernet +constexpr Pin EthernetPhyInterruptPin = PortCPin(6); +constexpr Pin EthernetPhyResetPin = PortDPin(11); +constexpr Pin EthernetPhyOtherPins[] = { + PortDPin(0), PortDPin(1), PortDPin(2), PortDPin(3), PortDPin(4), + PortDPin(5), PortDPin(6), PortDPin(7), PortDPin(8), PortDPin(9) +}; +constexpr auto EthernetPhyOtherPinsFunction = GpioPinFunction::A; + +// Shared SPI definitions +#define USART_SPI 1 +#define USART_SSPI USART0 +#define ID_SSPI ID_USART0 + +// List of assignable pins and their mapping from names to MPU ports. This is indexed by logical pin number. +// The names must match user input that has been concerted to lowercase and had _ and - characters stripped out. +// Aliases are separate by the , character. +// If a pin name is prefixed by ! then this means the pin is hardware inverted. The same pin may have names for both the inverted and non-inverted cases, +// for example the inverted heater pins on the expansion connector are available as non-inverted servo pins on a DueX. +//TODO change the table below for the V0.6 board +constexpr PinDescription PinTable[] = +{ + // TC PWM ADC Capability PinNames + // Port A + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "io6.out" }, // PA00 IO6_OUT + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::read, "out6.tach" }, // PA01 OUT6_TACH + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA02 NC + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "io3.out" }, // PA03 IO3_OUT + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA04 driver 2 dir + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "spi.cs0,serial3.rx"}, // PA05 SPI_CS0 and Serial3 RX + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "spi.cs1,serial3.tx"}, // PA06 SPI_CS1 abd Serial3 TX + { TcOutput::none, PwmOutput::pwm0h3_b,AdcInput::none, PinCapability::wpwm, "out0" }, // PA07 OUT0 + { TcOutput::none, PwmOutput::pwm1h3_a,AdcInput::none, PinCapability::wpwm, "out6" }, // PA08 OUT6 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA09 Tmc51xxEnablePin + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::write, "pson" }, // PA10 PS_ON + { TcOutput::none, PwmOutput::pwm0h0_b,AdcInput::none, PinCapability::wpwm, "out3" }, // PA11 OUT3 + { TcOutput::none, PwmOutput::pwm1h0_c,AdcInput::none, PinCapability::wpwm, "out9,laser,vfd" }, // PA12 OUT9 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA13 DotStarMosi + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA14 DotStarSclk + { TcOutput::tioa1, PwmOutput::none, AdcInput::none, PinCapability::wpwm, "out4" }, // PA15 OUT4 + { TcOutput::none, PwmOutput::pwm0l2_c,AdcInput::none, PinCapability::wpwm, "out2" }, // PA16 OUT2 + { TcOutput::none, PwmOutput::none, AdcInput::adc0_6, PinCapability::ainr, "io7.in" }, // PA17 IO7_IN + { TcOutput::none, PwmOutput::none, AdcInput::adc0_7, PinCapability::ainr, "io6.in" }, // PA18 IO6_IN + { TcOutput::none, PwmOutput::none, AdcInput::adc0_8, PinCapability::ainr, "io5.in" }, // PA19 IO5_IN + { TcOutput::none, PwmOutput::none, AdcInput::adc0_9, PinCapability::none, nullptr }, // PA20 VIN detect + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA21 TMC51xxMisoPin + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA22 driver 3 dir + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA23 TMC51xxSclkPin + { TcOutput::none, PwmOutput::pwm0h1_b,AdcInput::none, PinCapability::wpwm, "out1" }, // PA24 OUT1 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA25 SDHC MCCK + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA26 SDHC MCDA2 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA27 SDHC MCDA3 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA28 SDHC MCCDA + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA29 SdCardDetectPin + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA30 SDHC MCDA0 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PA31 SDHC MCDA1 + + // Port B + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB00 USART_SSPI_MISO + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB01 USART_SSPI_MOSI + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB02 CAN0_TX + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB03 CAN0_RX + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB04 TMC51xxMosiPin + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB05 driver 0 dir + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB06 SWDIO + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB07 SWCLK + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB08 Crystal + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB09 Crystal + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB10 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB11 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB12 Erase + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB13 USART_SSPI_SCK + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB14 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB15 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB16 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB17 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB18 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB19 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB20 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB21 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB22 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB23 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB24 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB25 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB26 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB27 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB28 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB29 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB30 not on chip + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PB31 not on chip + + // Port C + { TcOutput::none, PwmOutput::none, AdcInput::adc1_9, PinCapability::none, nullptr }, // PC00 VrefSensePin + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC01 driver 3 step + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC02 driver 3 diag + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC03 driver 4 dir + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC04 driver 4 step + { TcOutput::tioa6, PwmOutput::none, AdcInput::none, PinCapability::wpwm, "out5" }, // PC05 OUT5 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC06 EthernetPhyInterrupt + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::read, "out4.tach" }, // PC07 OUT4_TACH + { TcOutput::tioa7, PwmOutput::none, AdcInput::none, PinCapability::wpwm, "out8" }, // PC08 OUT8 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC09 driver 5 step + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC10 driver 5 diag + { TcOutput::tioa8, PwmOutput::none, AdcInput::none, PinCapability::wpwm, "out7" }, // PC11 OUT7 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC12 CAN1_RX + { TcOutput::none, PwmOutput::none, AdcInput::adc1_1, PinCapability::none, nullptr }, // PC13 VssaSensePin + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC14 NC + { TcOutput::none, PwmOutput::none, AdcInput::adc1_2, PinCapability::ainr, "temp0" }, // PC15 thermistor 0 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC16 driver 1 step + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC17 driver 1 diag + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC18 driver 0 step + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC19 ETH_LED_Y + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC20 DiagPin + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC21 UsbVBusPin + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "spi.cs3" }, // PC22 SPI CS3 + { TcOutput::tioa3, PwmOutput::none, AdcInput::none, PinCapability::rwpwm, "io7.out" }, // PC23 IO7_OUT + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC24 SBC_SPI_SCK + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC25 SBC_SPI_SS0 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC26 SBC_SPI_MISO + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC27 SBC_SPI_MOSI + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PC28 driver 2 step + { TcOutput::tioa5, PwmOutput::none, AdcInput::adc1_4, PinCapability::ainrwpwm,"temp1" }, // PC29 thermistor 1 + { TcOutput::none, PwmOutput::none, AdcInput::adc1_5, PinCapability::ainr, "temp2" }, // PC30 thermistor 2 + { TcOutput::none, PwmOutput::none, AdcInput::adc1_6, PinCapability::ainr, "temp3" }, // PC31 thermistor 3 + + // PORT D + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD00 GTXCK + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD01 GTXEN + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD02 GTX0 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD03 GTX1 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD04 GRXDV + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD05 GRX0 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD06 GRX1 + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD07 GRXER + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD08 GMDC + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD09 GMDIO + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD10 driver 1 dir + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD11 EthernetPhyReset + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD12 CAN1_TX + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD13 driver 2 diag + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD14 driver 5 dir + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::read, "io1.in,serial1.rx" }, // PD15 IO1_IN and Serial1 RX + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "io1.out,serial1.tx"}, // PD16 IO1_OUT and Serial1 TX + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD17 Tmc51xxCSPin + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD18 NC + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD19 NC + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "spi.cs2" }, // PD20 SPI CS2 + { TcOutput::tioa11, PwmOutput::none, AdcInput::none, PinCapability::rwpwm, "io5.out" }, // PD21 IO5_OUT + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD22 NC + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::read, "out5.tach" }, // PD23 OUT5_TACH + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD24 SWD_EXT_RST + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::read, "io0.in,serial0.rx" }, // PD25 IO0_IN Serial0 RX + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "io0.out,serial0.tx"}, // PD26 IO0_OUT Serial0 TX + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "io2.out,i2c0.dat" }, // PD27 IO2_OUT + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::read, "io2.in,i2c0.clk" }, // PD28 IO2_IN + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD29 driver 0 diag + { TcOutput::none, PwmOutput::none, AdcInput::adc0_0, PinCapability::ainr, "io4.in" }, // PD30 IO4_IN + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PD31 driver 4 diag + + // Port E + { TcOutput::tioa9, PwmOutput::none, AdcInput::none, PinCapability::rwpwm, "io4.out" }, // PE00 IO4_OUT + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::rw, "io8.out" }, // PE01 IO8_OUT + { TcOutput::none, PwmOutput::none, AdcInput::none, PinCapability::none, nullptr }, // PE02 SbcTfrReady + { TcOutput::none, PwmOutput::none, AdcInput::adc1_10, PinCapability::read, "io8.in" }, // PE03 IO8_IN analog in not usable because it is on the wrong ADC + { TcOutput::none, PwmOutput::none, AdcInput::adc0_4, PinCapability::none, nullptr }, // PE04 V12 detect + { TcOutput::none, PwmOutput::none, AdcInput::adc0_3, PinCapability::ainr, "io3.in" }, // PE05 IO3_IN +}; + +constexpr unsigned int NumNamedPins = ARRAY_SIZE(PinTable); +static_assert(NumNamedPins == 32+32+32+32+6); + +// Function to look up a pin name pass back the corresponding index into the pin table +bool LookupPinName(const char *pn, LogicalPin& lpin, bool& hardwareInverted) noexcept; + +// Serial Interfaces +constexpr Pin APIN_Serial0_RXD = PortDPin(25); +constexpr Pin APIN_Serial0_TXD = PortDPin(26); +constexpr auto Serial0PinFunction = GpioPinFunction::C; +constexpr Pin APIN_Serial1_RXD = PortDPin(15); +constexpr Pin APIN_Serial1_TXD = PortDPin(16); +constexpr auto Serial1PinFunction = GpioPinFunction::B; + +// SD Card +constexpr Pin HsmciMclkPin = PortAPin(25); +constexpr auto HsmciMclkPinFunction = GpioPinFunction::D; +constexpr Pin HsmciOtherPins[] = { PortAPin(26), PortAPin(27), PortAPin(28), PortAPin(30), PortAPin(31) }; +constexpr auto HsmciOtherPinsFunction = GpioPinFunction::C; + +// Duet pin numbers for the SBC interface +#define SBC_SPI SPI1 +#define SBC_SPI_INTERFACE_ID ID_SPI1 +#define SBC_SPI_IRQn SPI1_IRQn +#define SBC_SPI_HANDLER SPI1_Handler + +constexpr Pin APIN_SBC_SPI_MOSI = PortCPin(27); +constexpr Pin APIN_SBC_SPI_MISO = PortCPin(26); +constexpr Pin APIN_SBC_SPI_SCK = PortCPin(24); +constexpr Pin APIN_SBC_SPI_SS0 = PortCPin(25); +constexpr GpioPinFunction SBCPinPeriphMode = GpioPinFunction::C; + +// CAN +constexpr Pin APIN_CAN0_RX = PortBPin(3); +constexpr Pin APIN_CAN0_TX = PortBPin(2); +constexpr GpioPinFunction CAN0PinPeriphMode = GpioPinFunction::A; + +constexpr Pin APIN_CAN1_RX = PortCPin(12); +constexpr GpioPinFunction CAN1RXPinPeriphMode = GpioPinFunction::C; +constexpr Pin APIN_CAN1_TX = PortDPin(12); +constexpr GpioPinFunction CAN1TXPinPeriphMode = GpioPinFunction::B; + +constexpr unsigned int CanDeviceNumber = 1; // CAN-FD device number + +#if defined(DUAL_CAN) && DUAL_CAN +constexpr unsigned int SecondaryCanDeviceNumber = 0; // plan CAN device number +#endif + +constexpr Pin SbcTfrReadyPin = PortEPin(2); +// Note, the DMAC peripheral IDs are hard-coded in DataTransfer + +// Timer allocation +// Step timer is timer 0 aka TC0 channel 0. Also used as the CAN timestamp counter. +#define STEP_TC (TC0) +#define STEP_TC_CHAN (0) // channel for lower 16 bits +#define STEP_TC_CHAN_UPPER (2) // channel for upper 16 bits +#define STEP_TC_IRQN TC0_IRQn +#define STEP_TC_HANDLER TC0_Handler +#define STEP_TC_ID ID_TC0 +#define STEP_TC_ID_UPPER ID_TC2 + +// DMA channel allocation +constexpr DmaChannel DmacChanHsmci = 0; // this is hard coded in the ASF HSMCI driver +//constexpr DmaChannel DmacChanWiFiTx = 1; // only on v0.3 board +//constexpr DmaChannel DmacChanWiFiRx = 2; // only on v0.3 board +constexpr DmaChannel DmacChanTmcTx = 3; +constexpr DmaChannel DmacChanTmcRx = 4; +constexpr DmaChannel DmacChanSbcTx = 5; +constexpr DmaChannel DmacChanSbcRx = 6; +constexpr DmaChannel DmacChanDotStarTx = 7; + +constexpr size_t NumDmaChannelsUsed = 8; + +namespace StepPins +{ + // *** These next three functions must use the same bit assignments in the drivers bitmap *** + // Each stepper driver must be assigned one bit in a 32-bit word, in such a way that multiple drivers can be stepped efficiently + // and more or less simultaneously by doing parallel writes to several bits in one or more output ports. + // All our step pins are on port C, so the bitmap is just the map of step bits in port C. + + // Calculate the step bit for a driver. This doesn't need to be fast. It must return 0 if the driver is remote. + static inline uint32_t CalcDriverBitmap(size_t driver) noexcept + { + return (driver < NumDirectDrivers) + ? 1u << (STEP_PINS[driver] & 0x1Fu) + : 0; + } + + // Set the specified step pins high. This needs to be fast. + static inline __attribute__((always_inline)) void StepDriversHigh(uint32_t driverMap) noexcept + { + PIOC->PIO_SODR = driverMap; // on Duet 3 all step pins are on port C + } + + // Set the specified step pins low. This needs to be fast. + static inline __attribute__((always_inline)) void StepDriversLow(uint32_t driverMap) noexcept + { + PIOC->PIO_CODR = driverMap; // on Duet 3 all step pins are on port C + } +} + +#endif //ifndef PINS_DUET3_MB6XD_H__ diff --git a/src/DuetM/Pins_DuetM.h b/src/Config/Pins_DuetM.h index 3b6e402b..3b6e402b 100644 --- a/src/DuetM/Pins_DuetM.h +++ b/src/Config/Pins_DuetM.h diff --git a/src/DuetNG/Pins_DuetNG.h b/src/Config/Pins_DuetNG.h index b62b4b5e..b62b4b5e 100644 --- a/src/DuetNG/Pins_DuetNG.h +++ b/src/Config/Pins_DuetNG.h diff --git a/src/Pccb/Pins_Pccb.h b/src/Config/Pins_Pccb.h index a069e505..a069e505 100644 --- a/src/Pccb/Pins_Pccb.h +++ b/src/Config/Pins_Pccb.h diff --git a/src/Display/Display.cpp b/src/Display/Display.cpp index da24f428..a69d0517 100644 --- a/src/Display/Display.cpp +++ b/src/Display/Display.cpp @@ -11,10 +11,9 @@ #include "Lcd/ST7920/Lcd7920.h" #include "Lcd/ST7567/Lcd7567.h" -#include "GCodes/GCodes.h" -#include "GCodes/GCodeBuffer/GCodeBuffer.h" -#include "Hardware/IoPorts.h" -#include "Pins.h" +#include <GCodes/GCodes.h> +#include <GCodes/GCodeBuffer/GCodeBuffer.h> +#include <Hardware/IoPorts.h> constexpr int DefaultPulsesPerClick = -4; // values that work with displays I have are 2 and -4 diff --git a/src/Display/Lcd/Lcd.cpp b/src/Display/Lcd/Lcd.cpp index 2946d742..ad8df632 100644 --- a/src/Display/Lcd/Lcd.cpp +++ b/src/Display/Lcd/Lcd.cpp @@ -5,7 +5,6 @@ #if SUPPORT_12864_LCD -#include "Pins.h" #include <Hardware/SharedSpi/SharedSpiDevice.h> Lcd::Lcd(PixelNumber nr, PixelNumber nc, const LcdFont * const fnts[], size_t nFonts, SpiMode mode) noexcept diff --git a/src/Display/Lcd/ST7920/Lcd7920.cpp b/src/Display/Lcd/ST7920/Lcd7920.cpp index c499708d..71111ac8 100644 --- a/src/Display/Lcd/ST7920/Lcd7920.cpp +++ b/src/Display/Lcd/ST7920/Lcd7920.cpp @@ -5,8 +5,6 @@ #if SUPPORT_12864_LCD -#include "Pins.h" - // LCD basic instructions. These all take 72us to execute except LcdDisplayClear, which takes 1.6ms constexpr uint8_t LcdDisplayClear = 0x01; constexpr uint8_t LcdHome = 0x02; diff --git a/src/Display/RotaryEncoder.cpp b/src/Display/RotaryEncoder.cpp index 7a220e27..50558cb3 100644 --- a/src/Display/RotaryEncoder.cpp +++ b/src/Display/RotaryEncoder.cpp @@ -2,8 +2,7 @@ #if SUPPORT_12864_LCD -#include "Pins.h" -#include "Hardware/IoPorts.h" +#include <Hardware/IoPorts.h> RotaryEncoder::RotaryEncoder(Pin p0, Pin p1, Pin pb) noexcept : pin0(p0), pin1(p1), pinButton(pb), ppc(1), encoderChange(0), encoderState(0), newPress(false), reverseDirection(false) {} diff --git a/src/Duet3Mini/Pins_Duet3Mini.cpp b/src/Duet3Mini/Pins_Duet3Mini.cpp deleted file mode 100644 index 500f8051..00000000 --- a/src/Duet3Mini/Pins_Duet3Mini.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Pins_Duet5LC.cpp - * - * Created on: 19 Jun 2020 - * Author: David - */ - - -#include "RepRapFirmware.h" - -// Hardware-dependent pins functions - -// Return a pointer to the pin description entry. Declared in and called from CoreN2G. -const PinDescriptionBase *AppGetPinDescription(Pin p) noexcept -{ - return (p < ARRAY_SIZE(PinTable)) ? &PinTable[p] : nullptr; -} - -// Function to look up a pin name and pass back the corresponding index into the pin table -// On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup -bool LookupPinName(const char *pn, LogicalPin &lpin, bool &hardwareInverted) noexcept -{ - if (StringEqualsIgnoreCase(pn, NoPinName)) - { - lpin = NoLogicalPin; - hardwareInverted = false; - return true; - } - - for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) - { - const char *q = PinTable[lp].pinNames; - if (q == nullptr) - { - continue; - } - while (*q != 0) - { - // Try the next alias in the list of names for this pin - const char *p = pn; - bool hwInverted = (*q == '!'); - if (hwInverted) - { - ++q; - } - while (*q != ',' && *q != 0 && *p == *q) - { - ++p; - ++q; - } - if (*p == 0 && (*q == 0 || *q == ',')) - { - // Found a match - lpin = (LogicalPin)lp; - hardwareInverted = hwInverted; - return true; - } - - // Skip to the start of the next alias - while (*q != 0 && *q != ',') - { - ++q; - } - if (*q == ',') - { - ++q; - } - } - } - return false; -} - -// End diff --git a/src/Duet3_V06/Pins_Duet3_V06.cpp b/src/Duet3_V06/Pins_Duet3_V06.cpp deleted file mode 100644 index 5fa45a32..00000000 --- a/src/Duet3_V06/Pins_Duet3_V06.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Pins_DuetNG.cpp - * - * Created on: 31 Mar 2019 - * Author: David - */ - -#include "RepRapFirmware.h" - -// Hardware-dependent pins functions - -// Return a pointer to the pin description entry. Declared in and called from CoreN2G. -const PinDescriptionBase *AppGetPinDescription(Pin p) noexcept -{ - return (p < ARRAY_SIZE(PinTable)) ? &PinTable[p] : nullptr; -} - -// Function to look up a pin name and pass back the corresponding index into the pin table -// On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup -bool LookupPinName(const char *pn, LogicalPin &lpin, bool &hardwareInverted) noexcept -{ - if (StringEqualsIgnoreCase(pn, NoPinName)) - { - lpin = NoLogicalPin; - hardwareInverted = false; - return true; - } - - for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) - { - const char *q = PinTable[lp].pinNames; - if (q == nullptr) - { - continue; - } - while (*q != 0) - { - // Try the next alias in the list of names for this pin - const char *p = pn; - bool hwInverted = (*q == '!'); - if (hwInverted) - { - ++q; - } - while (*q != ',' && *q != 0 && *p == *q) - { - ++p; - ++q; - } - if (*p == 0 && (*q == 0 || *q == ',')) - { - // Found a match - lpin = (LogicalPin)lp; - hardwareInverted = hwInverted; - return true; - } - - // Skip to the start of the next alias - while (*q != 0 && *q != ',') - { - ++q; - } - if (*q == ',') - { - ++q; - } - } - } - return false; -} - -// End diff --git a/src/DuetM/Pins_DuetM.cpp b/src/DuetM/Pins_DuetM.cpp deleted file mode 100644 index 8fcbda72..00000000 --- a/src/DuetM/Pins_DuetM.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Pins_DuetM.cpp - * - * Created on: 15 Apr 2019 - * Author: David - */ - -#include "RepRapFirmware.h" - -// Hardware-dependent pins functions - -// Return a pointer to the pin description entry. Declared in and called from CoreN2G. -const PinDescriptionBase *AppGetPinDescription(Pin p) noexcept -{ - return (p < ARRAY_SIZE(PinTable)) ? &PinTable[p] : nullptr; -} - -// Function to look up a pin name and pass back the corresponding index into the pin table -// On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup -bool LookupPinName(const char *pn, LogicalPin &lpin, bool &hardwareInverted) noexcept -{ - if (StringEqualsIgnoreCase(pn, NoPinName)) - { - lpin = NoLogicalPin; - hardwareInverted = false; - return true; - } - - for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) - { - const char *q = PinTable[lp].pinNames; - if (q == nullptr) - { - continue; - } - while (*q != 0) - { - // Try the next alias in the list of names for this pin - const char *p = pn; - bool hwInverted = (*q == '!'); - if (hwInverted) - { - ++q; - } - while (*q != ',' && *q != 0 && *p == *q) - { - ++p; - ++q; - } - if (*p == 0 && (*q == 0 || *q == ',')) - { - // Found a match - lpin = (LogicalPin)lp; - hardwareInverted = hwInverted; - return true; - } - - // Skip to the start of the next alias - while (*q != 0 && *q != ',') - { - ++q; - } - if (*q == ',') - { - ++q; - } - } - } - return false; -} - -// End diff --git a/src/DuetNG/Pins_DuetNG.cpp b/src/DuetNG/Pins_DuetNG.cpp deleted file mode 100644 index 5fa45a32..00000000 --- a/src/DuetNG/Pins_DuetNG.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Pins_DuetNG.cpp - * - * Created on: 31 Mar 2019 - * Author: David - */ - -#include "RepRapFirmware.h" - -// Hardware-dependent pins functions - -// Return a pointer to the pin description entry. Declared in and called from CoreN2G. -const PinDescriptionBase *AppGetPinDescription(Pin p) noexcept -{ - return (p < ARRAY_SIZE(PinTable)) ? &PinTable[p] : nullptr; -} - -// Function to look up a pin name and pass back the corresponding index into the pin table -// On this platform, the mapping from pin names to pins is fixed, so this is a simple lookup -bool LookupPinName(const char *pn, LogicalPin &lpin, bool &hardwareInverted) noexcept -{ - if (StringEqualsIgnoreCase(pn, NoPinName)) - { - lpin = NoLogicalPin; - hardwareInverted = false; - return true; - } - - for (size_t lp = 0; lp < ARRAY_SIZE(PinTable); ++lp) - { - const char *q = PinTable[lp].pinNames; - if (q == nullptr) - { - continue; - } - while (*q != 0) - { - // Try the next alias in the list of names for this pin - const char *p = pn; - bool hwInverted = (*q == '!'); - if (hwInverted) - { - ++q; - } - while (*q != ',' && *q != 0 && *p == *q) - { - ++p; - ++q; - } - if (*p == 0 && (*q == 0 || *q == ',')) - { - // Found a match - lpin = (LogicalPin)lp; - hardwareInverted = hwInverted; - return true; - } - - // Skip to the start of the next alias - while (*q != 0 && *q != ',') - { - ++q; - } - if (*q == ',') - { - ++q; - } - } - } - return false; -} - -// End diff --git a/src/Fans/LedStripDriver.cpp b/src/Fans/LedStripDriver.cpp index f098e6eb..c42b20df 100644 --- a/src/Fans/LedStripDriver.cpp +++ b/src/Fans/LedStripDriver.cpp @@ -15,8 +15,8 @@ #include <GCodes/GCodes.h> // Define which types of LED strip this hardware supports -#define SUPPORT_DMA_NEOPIXEL (defined(DUET3_V06) || defined(DUET3MINI) || defined(PCCB_10)) -#define SUPPORT_DMA_DOTSTAR (defined(DUET3_V06) || defined(PCCB_10)) +#define SUPPORT_DMA_NEOPIXEL (defined(DUET3_MB6HC) || defined(DUET3_MB6XD) || defined(DUET3MINI) || defined(PCCB_10)) +#define SUPPORT_DMA_DOTSTAR (defined(DUET3_MB6HC) || defined(DUET3_MB6XD) || defined(PCCB_10)) #define SUPPORT_BITBANG_NEOPIXEL (defined(DUET3MINI) || defined(DUET_NG)) #if SUPPORT_DMA_NEOPIXEL || SUPPORT_DMA_DOTSTAR @@ -56,7 +56,7 @@ namespace LedStripDriver constexpr uint32_t MinNeoPixelResetTicks = (250 * StepClockRate)/1000000; // 250us minimum Neopixel reset time on later chips // Define the size of the buffer used to accumulate a sequence of colours to send to the string -#if defined(DUET3_V06) +#if defined(DUET3_MB6HC) || defined(DUET3_MB6XD) // We have plenty of non-cached RAM left on Duet 3 constexpr size_t ChunkBufferSize = 240 * 16; // DotStar LEDs use 4 bytes/LED, NeoPixel RGBW use 16 bytes/LED #elif defined(DUET3MINI) @@ -457,7 +457,7 @@ void LedStripDriver::Init() noexcept hri_mclk_set_AHBMASK_QSPI_bit(MCLK); hri_mclk_clear_AHBMASK_QSPI_2X_bit(MCLK); // we don't need the 2x clock hri_mclk_set_APBCMASK_QSPI_bit(MCLK); -#elif defined(DUET3_V06) || defined(PCCB_10) +#elif defined(DUET3_MB6HC) || defined(DUET3_MB6XD) || defined(PCCB_10) SetPinFunction(DotStarMosiPin, DotStarPinMode); SetPinFunction(DotStarSclkPin, DotStarPinMode); pmc_enable_periph_clk(DotStarClockId); // enable the clock to the USART or SPI peripheral diff --git a/src/Hardware/IoPorts.cpp b/src/Hardware/IoPorts.cpp index e5355791..5db13337 100644 --- a/src/Hardware/IoPorts.cpp +++ b/src/Hardware/IoPorts.cpp @@ -8,7 +8,6 @@ #include "IoPorts.h" #include <Platform/RepRap.h> #include <Platform/Platform.h> -#include <Configuration.h> #include <GCodes/GCodeBuffer/GCodeBuffer.h> #ifdef DUET_NG diff --git a/src/Heating/Sensors/LinearAnalogSensor.cpp b/src/Heating/Sensors/LinearAnalogSensor.cpp index 7f8bf0a8..2c1f3b7e 100644 --- a/src/Heating/Sensors/LinearAnalogSensor.cpp +++ b/src/Heating/Sensors/LinearAnalogSensor.cpp @@ -7,7 +7,6 @@ #include "LinearAnalogSensor.h" #include <GCodes/GCodeBuffer/GCodeBuffer.h> -#include <Pins.h> #include <Platform/RepRap.h> #include <Platform/Platform.h> diff --git a/src/Movement/StepperDrivers/TMC2660.h b/src/Movement/StepperDrivers/TMC2660.h index 7a38626a..438e6571 100644 --- a/src/Movement/StepperDrivers/TMC2660.h +++ b/src/Movement/StepperDrivers/TMC2660.h @@ -12,7 +12,6 @@ #include <RepRapFirmware.h> #include "DriverMode.h" -#include <Pins.h> namespace SmartDrivers { diff --git a/src/Networking/Network.cpp b/src/Networking/Network.cpp index 887b3f78..04ab7312 100644 --- a/src/Networking/Network.cpp +++ b/src/Networking/Network.cpp @@ -86,7 +86,7 @@ Network::Network(Platform& p) noexcept : platform(p) #if defined(DUET3_V03) interfaces[0] = new LwipEthernetInterface(p); interfaces[1] = new WiFiInterface(p); -#elif defined(SAME70XPLD) || defined(DUET3_V05) || defined(DUET3_V06) +#elif defined(DUET3_MB6HC) || defined(DUET3_MB6XD) interfaces[0] = new LwipEthernetInterface(p); #elif defined(DUET_NG) || defined(DUET3MINI) interfaces[0] = nullptr; // we set this up in Init() diff --git a/src/Networking/Network.h b/src/Networking/Network.h index abe30a0d..c0ce6e73 100644 --- a/src/Networking/Network.h +++ b/src/Networking/Network.h @@ -16,7 +16,7 @@ #if defined(DUET3_V03) const size_t NumNetworkInterfaces = 2; -#elif defined(DUET3_V06) || defined(DUET_NG) || defined(DUET_M) || defined(__LPC17xx__) || defined(PCCB) || defined(DUET3MINI) +#elif defined(DUET3_MB6HC) || defined(DUET3_MB6XD) || defined(DUET_NG) || defined(DUET_M) || defined(__LPC17xx__) || defined(PCCB) || defined(DUET3MINI) const size_t NumNetworkInterfaces = 1; #else # error Wrong Network.h file included diff --git a/src/Networking/W5500Ethernet/MdnsResponder.h b/src/Networking/W5500Ethernet/MdnsResponder.h index 6cea0d01..71421e80 100644 --- a/src/Networking/W5500Ethernet/MdnsResponder.h +++ b/src/Networking/W5500Ethernet/MdnsResponder.h @@ -14,7 +14,7 @@ #include <General/IPAddress.h> #include <General/StringRef.h> -#include "Configuration.h" +#include <Config/Configuration.h> #include "NetworkDefs.h" class W5500Socket; diff --git a/src/Networking/W5500Ethernet/Wiznet/Ethernet/WizSpi.cpp b/src/Networking/W5500Ethernet/Wiznet/Ethernet/WizSpi.cpp index 13c62649..525767d5 100644 --- a/src/Networking/W5500Ethernet/Wiznet/Ethernet/WizSpi.cpp +++ b/src/Networking/W5500Ethernet/Wiznet/Ethernet/WizSpi.cpp @@ -6,7 +6,7 @@ */ #include "WizSpi.h" -#include "Pins.h" +#include <Config/Pins.h> // Define exactly one of the following as 1, the other as zero #define USE_PDC 1 // use peripheral DMA controller diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index 8451560a..702e11ca 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -4405,7 +4405,7 @@ GCodeResult Platform::ConfigurePort(GCodeBuffer& gb, const StringRef& reply) THR // Exactly one of FHJPSR is allowed unsigned int charsPresent = 0; for (char c : -#ifdef DUET3_V06 +#ifdef DUET3_MB6HC (const char[]){'D', 'R', 'J', 'F', 'H', 'P', 'S'} #else (const char[]){'R', 'J', 'F', 'H', 'P', 'S'} @@ -4450,7 +4450,7 @@ GCodeResult Platform::ConfigurePort(GCodeBuffer& gb, const StringRef& reply) THR return spindles[slot].Configure(gb, reply); } -#ifdef DUET3_V06 +#ifdef DUET3_MB6HC case 64: // D # if HAS_SBC_INTERFACE if (!reprap.UsingSbcInterface()) diff --git a/src/RepRapFirmware.h b/src/RepRapFirmware.h index 2db51861..a6c743f4 100644 --- a/src/RepRapFirmware.h +++ b/src/RepRapFirmware.h @@ -105,8 +105,8 @@ enum class PinUsedBy : uint8_t sdCard }; -#include "Pins.h" -#include "Configuration.h" +#include <Config/Pins.h> +#include <Config/Configuration.h> static_assert(MinVisibleAxes <= MinAxes); static_assert(NumNamedPins <= 255 || sizeof(LogicalPin) > 1, "Need 16-bit logical pin numbers"); diff --git a/src/Storage/MassStorage.cpp b/src/Storage/MassStorage.cpp index dcab61c2..8529c02d 100644 --- a/src/Storage/MassStorage.cpp +++ b/src/Storage/MassStorage.cpp @@ -19,7 +19,7 @@ static_assert(SD_MMC_MEM_CNT == NumSdCards); # include <SBC/SbcInterface.h> #endif -#ifdef DUET3_V06 +#ifdef DUET3_MB6HC # include <GCodes/GCodeBuffer/GCodeBuffer.h> #endif @@ -97,7 +97,7 @@ static uint64_t GetFreeSpace(size_t slot) static const char * const VolPathNames[] = { "0:/", "1:/" }; static_assert(ARRAY_SIZE(VolPathNames) >= NumSdCards, "Incorrect VolPathNames array"); -#ifdef DUET3_V06 +#ifdef DUET3_MB6HC static IoPort sd1Ports[2]; // first element is CS port, second is CD port #endif @@ -181,7 +181,7 @@ static FileStore files[MAX_FILES]; #if HAS_MASS_STORAGE -# ifdef DUET3_V06 +# ifdef DUET3_MB6HC // Return the number of volumes, which on the 6HC is normally 1 but can be increased to 2 size_t MassStorage::GetNumVolumes() noexcept diff --git a/src/Storage/MassStorage.h b/src/Storage/MassStorage.h index 854d56b4..551bbe6a 100644 --- a/src/Storage/MassStorage.h +++ b/src/Storage/MassStorage.h @@ -2,7 +2,6 @@ #define MASSSTORAGE_H #include <RepRapFirmware.h> -#include <Pins.h> #include "FileWriteBuffer.h" #include <Libraries/Fatfs/ff.h> #include "FileStore.h" @@ -49,7 +48,7 @@ namespace MassStorage void CloseAllFiles() noexcept; void Spin() noexcept; -# ifdef DUET3_V06 +# ifdef DUET3_MB6HC size_t GetNumVolumes() noexcept; // The number of SD slots may be 1 or 2 on the 6HC # else inline size_t GetNumVolumes() noexcept { return NumSdCards; } @@ -105,7 +104,7 @@ namespace MassStorage InfoResult GetCardInfo(size_t slot, uint64_t& capacity, uint64_t& freeSpace, uint32_t& speed, uint32_t& clSize) noexcept; -# ifdef DUET3_V06 +# ifdef DUET3_MB6HC GCodeResult ConfigureSdCard(GCodeBuffer& gb, const StringRef& reply) THROWS(GCodeException); // Configure additional SD card slots # endif |