Go Down

Topic: SerialPort.h and "Serial" (Read 772 times) previous topic - next topic


Sep 18, 2013, 07:56 pm Last Edit: Sep 18, 2013, 08:13 pm by pito Reason: 1
What should be done in order to be able to name the new SerialPort (by fat16lib) class "Serial" (thus replace the old Serial automatically)?
Code: [Select]
SerialPort<0, 63, 63> Serial;

I've been trying to replace the standard Serial.print() with ie. NewSerial.print()
Code: [Select]
SerialPort<0, 63, 63> NewSerial;

but it seems to me it is almost impossible in practice. When replacing it in main I am getting zillion vector errors as it messes with all possible includes where the standard "Serial." is used..  :smiley-roll:


It is not possible to declare the name "Serial" since that will conflict with the symbol declared in HardwareSerial.

I use the following declaration and macro in sketches to minimize changes.
Code: [Select]

SerialPort<0, 63, 63> NewSerial;
#define Serial NewSerial

Serial must not be used in any libraries or HardwareSerial will be linked and a conflict will happen.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131