27 : RawSerial(tx, rx) , _rxbuf(buf_size), _txbuf((uint32_t)(tx_multiple*buf_size))
37 RawSerial::attach(NULL, RawSerial::RxIrq);
38 RawSerial::attach(NULL, RawSerial::TxIrq);
89 va_start(arg, format);
90 r = vsprintf(buffer, format, arg);
93 error(
"%s %d buffer overwrite (max_buf_size: %d exceeded: %d)!\r\n", __FILE__, __LINE__,this->
_buf_size,r);
105 if (s != NULL && length > 0) {
106 const char* ptr = (
const char*)s;
107 const char* end = ptr + length;
114 return ptr - (
const char*)s;
123 if(serial_readable(&_serial)) {
124 _rxbuf = serial_getc(&_serial);
133 while(serial_writable(&_serial)) {
135 serial_putc(&_serial, (
int)
_txbuf.
get());
138 RawSerial::attach(NULL, RawSerial::TxIrq);
149 if(serial_writable(&_serial)) {
150 RawSerial::attach(NULL, RawSerial::TxIrq);
virtual ssize_t write(const void *s, std::size_t length)
BufferedSerial(PinName tx, PinName rx, uint32_t buf_size=256, uint32_t tx_multiple=4, const char *name=NULL)
virtual int readable(void)
virtual int puts(const char *s)
virtual int printf(const char *format,...)
virtual ~BufferedSerial(void)
virtual int writeable(void)
Software Buffer - Extends mbed Serial functionallity adding irq driven TX and RX. ...