diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-03-22 17:04:30 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-03-22 17:04:30 +0300 |
commit | 1bb0921de6868bbba28e49bdf4c75485cf20108d (patch) | |
tree | ab44fb71142e07692c339432dddf5031248f0e17 /src | |
parent | 7b10730a5fee550e1d7b248631e900b88cd5b792 (diff) |
Replaced SetPullup calls by EnablePullup and DisablePullup
Also added ATX_POWER_INVERTED
Diffstat (limited to 'src')
-rw-r--r-- | src/Hardware/SAM4E/Devices.cpp | 6 | ||||
-rw-r--r-- | src/Hardware/SAM4S/Devices.cpp | 4 | ||||
-rw-r--r-- | src/Hardware/SAME70/Devices.cpp | 6 | ||||
-rw-r--r-- | src/Movement/StepperDrivers/TMC22xx.cpp | 2 | ||||
-rw-r--r-- | src/Pins.h | 4 | ||||
-rw-r--r-- | src/Platform/Platform.cpp | 21 |
6 files changed, 19 insertions, 24 deletions
diff --git a/src/Hardware/SAM4E/Devices.cpp b/src/Hardware/SAM4E/Devices.cpp index ca3ec53a..c5a5fcae 100644 --- a/src/Hardware/SAM4E/Devices.cpp +++ b/src/Hardware/SAM4E/Devices.cpp @@ -29,11 +29,11 @@ void SerialInit() noexcept { SetPinFunction(APIN_Serial0_RXD, Serial0PeriphMode); SetPinFunction(APIN_Serial0_TXD, Serial0PeriphMode); - SetPullup(APIN_Serial0_RXD, true); + EnablePullup(APIN_Serial0_RXD); SetPinFunction(APIN_Serial1_RXD, Serial1PeriphMode); SetPinFunction(APIN_Serial1_TXD, Serial1PeriphMode); - SetPullup(APIN_Serial1_RXD, true); + EnablePullup(APIN_Serial1_RXD); } void SdhcInit() noexcept @@ -42,7 +42,7 @@ void SdhcInit() noexcept for (Pin p : HsmciOtherPins) { SetPinFunction(p, HsmciPinsFunction); - SetPullup(p, true); + EnablePullup(p); } } diff --git a/src/Hardware/SAM4S/Devices.cpp b/src/Hardware/SAM4S/Devices.cpp index b388d6b7..85034312 100644 --- a/src/Hardware/SAM4S/Devices.cpp +++ b/src/Hardware/SAM4S/Devices.cpp @@ -24,7 +24,7 @@ void SerialInit() noexcept { SetPinFunction(APIN_Serial0_RXD, Serial0PeriphMode); SetPinFunction(APIN_Serial0_TXD, Serial0PeriphMode); - SetPullup(APIN_Serial0_RXD, true); + EnablePullup(APIN_Serial0_RXD); } #endif @@ -36,7 +36,7 @@ void SdhcInit() noexcept for (Pin p : HsmciOtherPins) { SetPinFunction(p, HsmciPinsFunction); - SetPullup(p, true); + EnablePullup(p); } } diff --git a/src/Hardware/SAME70/Devices.cpp b/src/Hardware/SAME70/Devices.cpp index 1b26e627..f6059509 100644 --- a/src/Hardware/SAME70/Devices.cpp +++ b/src/Hardware/SAME70/Devices.cpp @@ -29,11 +29,11 @@ void SerialInit() noexcept { SetPinFunction(APIN_Serial0_RXD, Serial0PinFunction); SetPinFunction(APIN_Serial0_TXD, Serial0PinFunction); - SetPullup(APIN_Serial0_RXD, true); + EnablePullup(APIN_Serial0_RXD); SetPinFunction(APIN_Serial1_RXD, Serial1PinFunction); SetPinFunction(APIN_Serial1_TXD, Serial1PinFunction); - SetPullup(APIN_Serial1_RXD, true); + EnablePullup(APIN_Serial1_RXD); } void SdhcInit() noexcept @@ -42,7 +42,7 @@ void SdhcInit() noexcept for (Pin p : HsmciOtherPins) { SetPinFunction(p, HsmciOtherPinsFunction); - SetPullup(p, true); + EnablePullup(p); } } diff --git a/src/Movement/StepperDrivers/TMC22xx.cpp b/src/Movement/StepperDrivers/TMC22xx.cpp index 46a7c4a2..c49c190b 100644 --- a/src/Movement/StepperDrivers/TMC22xx.cpp +++ b/src/Movement/StepperDrivers/TMC22xx.cpp @@ -1859,7 +1859,7 @@ void SmartDrivers::Init() noexcept // Set up the single UART that communicates with all TMC22xx drivers SetPinFunction(TMC22xxUartTxPin, TMC22xxUartPeriphMode); SetPinFunction(TMC22xxUartRxPin, TMC22xxUartPeriphMode); - SetPullup(TMC22xxUartRxPin, true); + EnablePullup(TMC22xxUartRxPin); // Enable the clock to the UART pmc_enable_periph_clk(ID_TMC22xx_UART); @@ -188,6 +188,10 @@ # define SUPPORT_ACCELEROMETERS 0 #endif +#ifndef ATX_POWER_INVERTED +# define ATX_POWER_INVERTED false +#endif + // We must define MCU_HAS_UNIQUE_ID as either 0 or 1 so we can use it in maths #if SAM4E || SAM4S || SAME70 || SAME5x # define MCU_HAS_UNIQUE_ID 1 diff --git a/src/Platform/Platform.cpp b/src/Platform/Platform.cpp index a07698b0..a1e47548 100644 --- a/src/Platform/Platform.cpp +++ b/src/Platform/Platform.cpp @@ -404,13 +404,15 @@ void Platform::Init() noexcept pinMode(EthernetPhyResetPin, OUTPUT_LOW); // hold the Ethernet Phy chip in reset, hopefully this will prevent it being too noisy if Ethernet is not enabled #endif +#ifndef __LPC17xx__ // Deal with power first (we assume this doesn't depend on identifying the board type) pinMode(ATX_POWER_PIN, OUTPUT_LOW); +#endif // Make sure the on-board drivers are disabled -#if defined(DUET_NG) || defined(PCCB_10) || defined(PCCB_08_X5) +#if defined(DUET_NG) || defined(PCCB_10) pinMode(GlobalTmc2660EnablePin, OUTPUT_HIGH); -#elif defined(DUET_M) || defined(PCCB_08) || defined(PCCB_08_X5) || defined(DUET3MINI) +#elif defined(DUET_M) || defined(DUET3MINI) pinMode(GlobalTmc22xxEnablePin, OUTPUT_HIGH); #endif @@ -471,10 +473,7 @@ void Platform::Init() noexcept #ifdef __LPC17xx__ // Load HW pin assignments from sdcard BoardConfig::Init(); - pinMode(ATX_POWER_PIN,(ATX_POWER_INVERTED==false)?OUTPUT_LOW:OUTPUT_HIGH); -#else - // Deal with power first (we assume this doesn't depend on identifying the board type) - pinMode(ATX_POWER_PIN,OUTPUT_LOW); + pinMode(ATX_POWER_PIN, (ATX_POWER_INVERTED) ? OUTPUT_HIGH : OUTPUT_LOW); #endif // Ethernet networking defaults @@ -3655,18 +3654,14 @@ void Platform::StopLogging() noexcept bool Platform::AtxPower() const noexcept { -#ifdef __LPC17xx__ const bool val = IoPort::ReadPin(ATX_POWER_PIN); return (ATX_POWER_INVERTED) ? !val : val; -#else - return IoPort::ReadPin(ATX_POWER_PIN); -#endif } void Platform::AtxPowerOn() noexcept { deferredPowerDown = false; - IoPort::WriteDigital(ATX_POWER_PIN, true); + IoPort::WriteDigital(ATX_POWER_PIN, !ATX_POWER_INVERTED); } void Platform::AtxPowerOff(bool defer) noexcept @@ -3682,11 +3677,7 @@ void Platform::AtxPowerOff(bool defer) noexcept // We don't call logger->Stop() here because we don't know whether turning off the power will work } #endif -#ifdef __LPC17xx__ IoPort::WriteDigital(ATX_POWER_PIN, ATX_POWER_INVERTED); -#else - IoPort::WriteDigital(ATX_POWER_PIN, false); -#endif } } |