| Summary |
#include <net_config.h>
int com_getchar (void);
|
| Description | The com_getchar function reads a character from the serial input buffer. The com_getchar 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_getchar function if the serial controller you use is different from the ones provided in the TCPnet source.
|
| Return Value | The com_getchar function returns the character value it read. It returns -1 if the input buffer is empty. |
| See Also | com_putchar, com_tx_active, init_serial |
| Example |
int com_getchar (void) {
/* Read a byte from serial interface */
struct buf_st *p = &rbuf;
if (p->in == p->out) {
/* Serial receive buffer is empty. */
return (-1);
}
return (p->buf[p->out++]);
}
|