Closed bombasticbob closed 10 years ago
Additionall Serial1 is incorrect as currently mapped. Either map PORTC pins 2 and 3 to pins 18 and 19, or use a different port for the default Serial1 on the atmega 'A' series.
ALTERNATELY...
In pins_arduino.h it should be possible to use #define to assign the port names for Serial0 through Serial7, and the corresponding digital pin assignments. This would also enable them to be implemented in 'core'.
Example:
(this would be the current behavior, with pin shift enabled)
Others would conditionally add support for Serial2, Serial3, etc. up to Serial7 in HardwareSerial.cpp and HardwareSerial.h
NOTE: it may be possible to simply read which pin is mapped by scanning the pin mapping arrays; however, it would increase the code size to do it this way.
this way a boardmaker that does NOT want to implement more than a certain number of serial ports can leave them out [and not have the memory footprint in the code]. Each serial port requires a buffer, and each buffer takes up RAM space, and even on xmega, this is limited.
in the process of implementing something similar to above (see wiki entry for implementing custom boards). Code is not yet checked in. Will initially support Serial, Serial2 and support Serial3 and Serial4 when the appropriate 'SERIAL_n_PORT_NAME' definition exists. Similar support for Serial5 through Serial8 is possible, and can be added later.
fold into issue #1. a method by which the serial ports can be implemented is already in place.
need to add serial ports 2 through 7 for the 128a1. Serial port 1 should also be moved to different virtual pins (see #1). Pin assignments for the MEGA2560 are 18/19 for serial 1, 16/17 for serial 2, 14/15 for serial 3, with tx on the even pin and rx on the odd pin.
NOTE: Serial 0 rx is on 0, and tx is on 1, which differs from that odd/even pattern.
Serial ports 4 through 7 can pretty much be put anywhere, and in some cases will HAVE to be since they correspond to the default SPI on port C in one case.
this will require re-doing pins_arduino.h for the 128a1, perhaps as a new variant (2560compat ?)