Go Down

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

pito

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:

fat16lib

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.

pito


Go Up