Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 3ca0bc1

Browse files
authored
Merge pull request #91 from manchoz/fix_can_init
Fix CAN object initialization
2 parents 6331d2c + efbd772 commit 3ca0bc1

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Arduino_MachineControl.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#include "utility/RTC/PCF8563T.h"
1010
#include "utility/RTC/PCF8563T.h"
1111

12-
#include "Arduino.h"
13-
#include "pinDefinitions.h"
14-
#include "mbed.h"
12+
#include <Arduino.h>
13+
#include <pinDefinitions.h>
14+
#include <mbed.h>
1515

1616
namespace machinecontrol {
1717

@@ -74,9 +74,6 @@ class RTDClass {
7474

7575
extern RTDClass temp_probes;
7676

77-
static mbed::CAN _can(PB_8, PH_13);
78-
79-
8077
/**
8178
* The COMMClass is used to initialize the CAN and RS485 LEDs and
8279
* establish the power mode of the CAN bus.
@@ -124,10 +121,10 @@ class COMMClass {
124121
can_disable = 1;
125122
}
126123

127-
UART _UART4_ = arduino::UART(PA_0, PI_9, NC, NC);
128-
mbed::CAN& can = _can;
124+
arduino::UART _UART4_ {PA_0, PI_9, NC, NC};
125+
mbed::CAN can {PB_8, PH_13};
129126

130-
RS485Class rs485 = RS485Class(_UART4_, PinNameToIndex(PA_0), PinNameToIndex(PI_13), PinNameToIndex(PI_10));
127+
RS485Class rs485 {_UART4_, PinNameToIndex(PA_0), PinNameToIndex(PI_13), PinNameToIndex(PI_10)};
131128

132129
void rs485Enable(bool enable) { digitalWrite(PinNameToIndex(PG_9), enable ? HIGH : LOW); }
133130
void rs485ModeRS232(bool enable) { digitalWrite(PinNameToIndex(PA_10), enable ? LOW : HIGH); }

0 commit comments

Comments
 (0)