Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/VescUart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ VescUart::VescUart(uint32_t timeout_ms) : _TIMEOUT(timeout_ms) {
nunchuck.upperButton = false;
}

void VescUart::setSerialPort(Stream* port)
void VescUart::setSerialPort( SERIAL_PORT_TYPE* port)
{
serialPort = port;
}

void VescUart::setDebugPort(Stream* port)
void VescUart::setDebugPort( SERIAL_PORT_TYPE* port)
{
debugPort = port;
}
Expand Down
16 changes: 16 additions & 0 deletions src/VescUart.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@
#include "buffer.h"
#include "crc.h"

// When using Arduino boards
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
#include <SoftwareSerial.h>
#define SERIAL_PORT_TYPE SoftwareSerial
// When using ESP32 or ESP8266 boards
#elif defined(ESP32) || defined(ESP8266)
#define SERIAL_PORT_TYPE HardwareSerial
// When using Teensy 4.0 board
#elif defined( __IMXRT1062__ )
#define SERIAL_PORT_TYPE HardwareSerialIMXRT
// Other boards can be defined below
#else
#define SERIAL_PORT_TYPE HardwareSerial
#endif


class VescUart
{

Expand Down