Pages: [1]   Go Down
Author Topic: SerialPort.h and "Serial"  (Read 549 times)
0 Members and 1 Guest are viewing this topic.
Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2071
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
SerialPort<0, 63, 63> Serial;

I've been trying to replace the standard Serial.print() with ie. NewSerial.print()
Code:
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
« Last Edit: September 18, 2013, 01:13:00 pm by pito » Logged

0
Offline Offline
Edison Member
*
Karma: 63
Posts: 1631
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2071
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It helped, thanks!
Logged

Pages: [1]   Go Up
Jump to: