4.3.4 Implement STDIO Receive and Send Functions
The function that handles STDIO is void puthc(char c)
.
Implementing this function will transmit its char argument over EUSART and will cause
printf
to be redirected to EUSART.
void putch(char txData)
{
EUSART2_write(txData);
}
Similarly, to implementing putch
, char
getch(void)
must be implemented so that the EUSART incoming data are mapped
to STDIO.
char getch(void)
{
return EUSART2_read();
}