Renaming the Hardware Serial ports on a Mega

I have an application that uses the hardware serial ports of a MEGA ie:

Serial1 // Terminal Serial2 // CellShield Serial3 // PixelBoard

How do I rename the Serial Ports? I am getting confused in my code at certain points. I have been used to the softserial which allows naming of the ports.

I tried:

HardwareSerial *CellShield;
CellShield= &Serial2;

but then any commands that I have need to be altered to something like:


is there another way?

#define Terminal Serial1
#define CellShield Serial2
#define PixelBoard Serial3

You could use a reference rather than a pointer, then the indirection is transparent from the point of view of the rest of the code.

Like this:

HardwareSerial & Terminal = Serial1;
HardwareSerial & CellShield = Serial2;

void setup ()
  Terminal.begin (9600);
  CellShield.begin (115200);
  }  // end of setup
void loop ()
  Terminal.println ("Hi there!");
  }  // end of loop

Thanks, that was exactly what I was looking for :)