|
| com_putchar| Summary | |
#include <net_config.h>
BOOL com_putchar (
U8 c ); /* The character to write to the output buffer. */
| | Description | | The com_putchar function writes the character specified by the argument c to the serial output buffer and activates the serial transmission if it is not already active. The com_putchar function is part of RL-TCPnet. The prototype is defined in net_config.h. note - The serial driver functions must not use waiting loops because loops block the TCPnet system.
- You must provide the com_putchar function if the serial controller you use is different from the ones provided in the TCPnet source.
| | Return Value | | The com_putchar function returns __TRUE if it successfully wrote the character into the output buffer. Otherwise, for example if the buffer is full, it returns __FALSE. | | See Also | | com_getchar, com_tx_active, init_serial | | Example | |
BOOL com_putchar (U8 c)
{
struct buf_st *p = &tbuf;
/* Write a byte to serial interface */
if ((U8)(p->in + 1) == p->out) {
/* Serial transmit buffer is full. */
return (__FALSE);
}
VICIntEnClr = (1 << 7);
if (tx_active == __FALSE) {
/* Send directly to UART. */
U1THR = (U8)c;
tx_active = __TRUE;
}
else {
/* Add data to transmit buffer. */
p->buf [p->in++] = c;
}
VICIntEnable |= (1 << 7);
return (__TRUE);
}
|
|
|