diff options
author | Manuel Coenen <manuel@duet3d.com> | 2021-01-22 18:31:28 +0300 |
---|---|---|
committer | Manuel Coenen <manuel@duet3d.com> | 2021-01-22 18:31:28 +0300 |
commit | 9df7f438ed60813fab0e6303b0302fe1b1a1121b (patch) | |
tree | 7e630ade47ae7b1db0e1d06a366198aeb734c05f /src/Movement | |
parent | 837875d24b3bb657245eafa9f22db1a23cfba6da (diff) |
Fix all compiler and linker errors for SAM4E+CoreN2G
Note: PinTable still empty
Diffstat (limited to 'src/Movement')
-rw-r--r-- | src/Movement/StepTimer.cpp | 4 | ||||
-rw-r--r-- | src/Movement/StepTimer.h | 2 | ||||
-rw-r--r-- | src/Movement/StepperDrivers/TMC2660.cpp | 17 |
3 files changed, 12 insertions, 11 deletions
diff --git a/src/Movement/StepTimer.cpp b/src/Movement/StepTimer.cpp index 13fc1b85..4046db18 100644 --- a/src/Movement/StepTimer.cpp +++ b/src/Movement/StepTimer.cpp @@ -20,8 +20,8 @@ # include <CoreIO.h> # include <hri_tc_e54.h> #elif !defined(__LPC17xx__) -# include <sam/drivers/tc/tc.h> -# if SAME70 +# include <tc/tc.h> +# if SAME70 || SAM4E # include <pmc/pmc.h> # endif #endif diff --git a/src/Movement/StepTimer.h b/src/Movement/StepTimer.h index 92cc86bf..a8ebfad2 100644 --- a/src/Movement/StepTimer.h +++ b/src/Movement/StepTimer.h @@ -67,7 +67,7 @@ public: #elif defined(__LPC17xx__) static constexpr uint32_t StepClockRate = 1000000; // 1MHz #else - static constexpr uint32_t StepClockRate = VARIANT_MCK/128; // Duet 2 and Maestro: use just under 1MHz + static constexpr uint32_t StepClockRate = SystemCoreClockFreq/128; // Duet 2 and Maestro: use just under 1MHz #endif static constexpr uint64_t StepClockRateSquared = (uint64_t)StepClockRate * StepClockRate; diff --git a/src/Movement/StepperDrivers/TMC2660.cpp b/src/Movement/StepperDrivers/TMC2660.cpp index 48d0bf5c..79b2bc44 100644 --- a/src/Movement/StepperDrivers/TMC2660.cpp +++ b/src/Movement/StepperDrivers/TMC2660.cpp @@ -17,13 +17,14 @@ #include <Cache.h> # if SAME70 -# include "sam/drivers/xdmac/xdmac.h" -# include "DmacManager.h" +# include <xdmac/xdmac.h> +# include <DmacManager.h> # else -# include "sam/drivers/pdc/pdc.h" +# include <pmc/pmc.h> +# include <pdc/pdc.h> # endif -#include "sam/drivers/usart/usart.h" +#include <usart/usart.h> constexpr float MaximumMotorCurrent = 2500.0; constexpr float MinimumOpenLoadMotorCurrent = 500; // minimum current in mA for the open load status to be taken seriously @@ -905,9 +906,9 @@ namespace SmartDrivers pinMode(GlobalTmc2660EnablePin, OUTPUT_HIGH); // The pins are already set up for SPI in the pins table - ConfigurePin(TMC2660MosiPin); - ConfigurePin(TMC2660MisoPin); - ConfigurePin(TMC2660SclkPin); + SetPinFunction(TMC2660MosiPin, TMC2660PeriphMode); + SetPinFunction(TMC2660MisoPin, TMC2660PeriphMode); + SetPinFunction(TMC2660SclkPin, TMC2660PeriphMode); // Enable the clock to the USART or SPI pmc_enable_periph_clk(ID_TMC2660_SPI); @@ -922,7 +923,7 @@ namespace SmartDrivers | US_MR_CHMODE_NORMAL | US_MR_CPOL | US_MR_CLKO; - USART_TMC2660->US_BRGR = VARIANT_MCK/DriversSpiClockFrequency; // set SPI clock frequency + USART_TMC2660->US_BRGR = SystemCoreClockFreq/DriversSpiClockFrequency; // set SPI clock frequency USART_TMC2660->US_CR = US_CR_RSTRX | US_CR_RSTTX | US_CR_RXDIS | US_CR_TXDIS | US_CR_RSTSTA; // We need a few microseconds of delay here for the USART to sort itself out before we send any data, |