I have got 3x buffered serial ports working fine, Uart0, Uart1, Bitbanged Uart3. I can transfer chars between them in any order so they are fine.
They are named Sin0, Sout0, Sin1, Sout1, Sin3, Sout3.
In one example file it said that if the user provides putchar and getchar, the higher level functions such as printf will use the user's version. I take it that this means that if the library detects something is already defined then the library version will not get compiled - is this correct?
I ask because I want to be able to use the higher level I/O functions on any of my 3x I/O ports. From the help file I suspect _getkey,sscanf,puts, ungetchar,gets,scanf,vpritf,printf,sprintf,vsprintf all operate via getchar and putchar - is this so?
So I am thinking that either to use #if.. #endif somehow, or to write a version of putchar and getchar that run the required comport routines.
something like Commout=Sout2, (stores a pointer of run address of Sout2) Commin=Sin2 (same)
So Putchar runs the function Sout2 and Getchar runs Sin2, until a redirection selects a different I/O port.
I can kind of work this out in assembler, but I am not that sure about how to do it in C.
I would really appreciate a "best approach" suggestion. I am probably asking a simple question, but right now I just dont have a handle on how to do it..