From efbd772ee0b4d79cc6ccde53e805731123ad0b22 Mon Sep 17 00:00:00 2001 From: Giampaolo Mancini Date: Thu, 16 Jun 2022 09:46:44 +0200 Subject: [PATCH] Fix CAN object initialization --- src/Arduino_MachineControl.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Arduino_MachineControl.h b/src/Arduino_MachineControl.h index e5aba58..6696608 100644 --- a/src/Arduino_MachineControl.h +++ b/src/Arduino_MachineControl.h @@ -9,9 +9,9 @@ #include "utility/RTC/PCF8563T.h" #include "utility/RTC/PCF8563T.h" -#include "Arduino.h" -#include "pinDefinitions.h" -#include "mbed.h" +#include +#include +#include namespace machinecontrol { @@ -74,9 +74,6 @@ class RTDClass { extern RTDClass temp_probes; -static mbed::CAN _can(PB_8, PH_13); - - /** * The COMMClass is used to initialize the CAN and RS485 LEDs and * establish the power mode of the CAN bus. @@ -124,10 +121,10 @@ class COMMClass { can_disable = 1; } - UART _UART4_ = arduino::UART(PA_0, PI_9, NC, NC); - mbed::CAN& can = _can; + arduino::UART _UART4_ {PA_0, PI_9, NC, NC}; + mbed::CAN can {PB_8, PH_13}; - RS485Class rs485 = RS485Class(_UART4_, PinNameToIndex(PA_0), PinNameToIndex(PI_13), PinNameToIndex(PI_10)); + RS485Class rs485 {_UART4_, PinNameToIndex(PA_0), PinNameToIndex(PI_13), PinNameToIndex(PI_10)}; void rs485Enable(bool enable) { digitalWrite(PinNameToIndex(PG_9), enable ? HIGH : LOW); } void rs485ModeRS232(bool enable) { digitalWrite(PinNameToIndex(PA_10), enable ? LOW : HIGH); }