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

Fix CAN object initialization #91

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/Arduino_MachineControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include "utility/RTC/PCF8563T.h"
#include "utility/RTC/PCF8563T.h"

#include "Arduino.h"
#include "pinDefinitions.h"
#include "mbed.h"
#include <Arduino.h>
#include <pinDefinitions.h>
#include <mbed.h>

namespace machinecontrol {

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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); }
Expand Down