This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Creating I/O stream

Hello forum,

I want to create a I/O stream in Keil and I can't seem to find how to.

In gcc I used FDEV_SETUP_STREAM macro. I just had to provide pointer to functions for writing and reading to/from the stream and the type of the stream (R/W).

A workaround in Keil is to redefine printf or even the low level functions that deal with streams.

However, I'm not interested in the workaround since I want to switch between 2 UARTS and one USB CDC serial stream. I would like to be able to do, like:

stdin = stdout = &UART1_stream;
printf("This text is printed via UART1");
stdin = stdout = &UART2_stream;
printf("This text is printed via UART2");
...

Any help appreciated.

0