#include "serial.h"
#include "fprintf.h"
tsFILE sSerStream;
tsSerialPortSetup sSerPort;
void vSerialInit(uint32 u32Baud, tsUartOpt *pUartOpt) {
// initialize sSerPort
...
SERIAL_vInit(&sSerPort);
// for vfPrintf()
sSerStream.bPutChar = SERIAL_bTxChar;
sSerStream.u8Device = E_AHI_UART_0;
}
void vSerOut() {
vfPrintf(&sSerStream, "HELLO!");
}
#include "serial.h"
#include "fprintf.h"
tsFILE sLcdStream;
// handle LCD display
PUBLIC bool_t LCD_bTxChar(uint8 u8Device, uint8 u8Data) {
int i;
switch (u8Data) {
case '\n':
...
}
void vInitHardware() {
/* Initisalise the LCD */
vLcdReset(3, 0);
/* register for vfPrintf() */
sLcdStream.bPutChar = LCD_bTxChar;
sLcdStream.u8Device = 0xFF;
}
void vSomeOutput() {
vfPrintf(&sLcdStream, "Hello World!\n");
}