1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
void setup()
{
Serial.begin(9600);
delay(500);
Serial.println("Station initiated");
}
/*********************************************************/
void loop()
{
Serial.println("Acknowledgement");
}
/********************************************************************** ******************
class HardwareSerial1
{
// library that handles hardware serial. Copyright (c) 2006 Nicholas Zambetti. All right reserved
public:
HardwareSerial1(int uart_nr);
};
HardwareSerial::HardwareSerial(int uart_nr) :
_uart_nr(uart_nr),
_uart(NULL),
_rxBufferSize(256),
_txBufferSize(0),
_onReceiveCB(NULL),
_onReceiveErrorCB(NULL),
_onReceiveTimeout(true),
_rxTimeout(10),
_eventTask(NULL)
{
}
HardwareSerial hardwareSerial;
/****************************************************************************************/
class TMC2209
{
// authored by Peter Polidoro peter@polidoro.io. Includes HardwareSerial.h (through arduino.h)
public:
enum SerialAddress
{
SERIAL_ADDRESS_0=0,
SERIAL_ADDRESS_1=1,
SERIAL_ADDRESS_2=2,
SERIAL_ADDRESS_3=3,
};
void setup(
HardwareSerial & serial,
long serial_baud_rate=115200,
SerialAddress serial_address=0);
///// <<<< error for the above line: invalid conversion from 'int' to 'TMC2209 SerialAddress' [-fpermissive]
};
void TMC2209::setup(
HardwareSerial & serial,
long serial_baud_rate,
SerialAddress serial_address)
{
// The serial_address will become (in subsequesnt method setOperationModeToSerial)
// a part of the datagram transmitted to the TMC2209 during read or write
}
TMC2209 stepper_driver;
/****************************************************************************************/
class Stepper
{
// a module I wrote that, as a part of the setup, should deliver the selected serial port
public:
bool begin(uint8_t ch);
};
bool Stepper::begin(uint8_t ch)
{
stepper_driver.setup(ch); // uint8_t ch is contains the identifier of the serial port
///// <<<< error for the above line: cannot bind non-const lvalue reference of type 'HardwareSerial&' to an rvalue of type 'HardwareSerial'
/****************************************************************************************/
|