C027 updated to work with latest mBed libraries

Dependents:   Cellular_HelloMQTT UBLOXModemDriver UBLOXMQTTDriver

Fork of C027_Support by u-blox

Embed: (wiki syntax)

« Back to documentation index

SerialPipe Class Reference

Buffered serial interface (rtos capable/interrupt driven) More...

#include <SerialPipe.h>

Inherited by GPSSerial, and MDMSerial.

Public Member Functions

 SerialPipe (PinName tx, PinName rx, int rxSize=128, int txSize=128)
 Constructor.
virtual ~SerialPipe (void)
 Destructor.
int writeable (void)
 check if writable return the number of free bytes
int putc (int c)
 send a character (blocking)
int put (const void *buffer, int length, bool blocking)
 send a buffer
int readable (void)
 check if readable
int getc (void)
 receive one character from the serial port (blocking)
int get (void *buffer, int length, bool blocking)
 read a buffer from the serial port

Protected Member Functions

void rxIrqBuf (void)
 receive interrupt routine
void txIrqBuf (void)
 transmit interrupt woutine
void txStart (void)
 start transmission helper
void txCopy (void)
 move bytes to hardware

Protected Attributes

Pipe< char > _pipeRx
 receive pipe
Pipe< char > _pipeTx
 transmit pipe

Detailed Description

Buffered serial interface (rtos capable/interrupt driven)

Definition at line 10 of file SerialPipe.h.


Constructor & Destructor Documentation

SerialPipe ( PinName  tx,
PinName  rx,
int  rxSize = 128,
int  txSize = 128 
)

Constructor.

Parameters:
txthe trasmitting pin
rxthe receiving pin
rxSizethe size of the receiving buffer
txSizethe size of the transmitting buffer

Definition at line 3 of file SerialPipe.cpp.

~SerialPipe ( void   ) [virtual]

Destructor.

Definition at line 12 of file SerialPipe.cpp.


Member Function Documentation

int get ( void *  buffer,
int  length,
bool  blocking 
)

read a buffer from the serial port

Parameters:
pointerto the buffer to read.
lengthnumber of bytes to read
blockingtrue if all bytes shall be read. false if only the available bytes.
Returns:
the number of bytes read.

Definition at line 94 of file SerialPipe.cpp.

int getc ( void   )

receive one character from the serial port (blocking)

Parameters:
thecharacter received

Definition at line 87 of file SerialPipe.cpp.

int put ( const void *  buffer,
int  length,
bool  blocking 
)

send a buffer

Parameters:
bufferthe buffer to send
lengththe size of the buffer to send
blocking,iftrue this function will block until all bytes placed in the buffer.
Returns:
the number of bytes written

Definition at line 31 of file SerialPipe.cpp.

int putc ( int  c )

send a character (blocking)

Parameters:
cthe character to send
Returns:
c

Definition at line 24 of file SerialPipe.cpp.

int readable ( void   )

check if readable

Returns:
the size available in the buffer.

Definition at line 82 of file SerialPipe.cpp.

void rxIrqBuf ( void   ) [protected]

receive interrupt routine

Definition at line 99 of file SerialPipe.cpp.

void txCopy ( void   ) [protected]

move bytes to hardware

Definition at line 54 of file SerialPipe.cpp.

void txIrqBuf ( void   ) [protected]

transmit interrupt woutine

Definition at line 63 of file SerialPipe.cpp.

void txStart ( void   ) [protected]

start transmission helper

Definition at line 71 of file SerialPipe.cpp.

int writeable ( void   )

check if writable return the number of free bytes

Definition at line 19 of file SerialPipe.cpp.


Field Documentation

Pipe<char> _pipeRx [protected]

receive pipe

Definition at line 78 of file SerialPipe.h.

Pipe<char> _pipeTx [protected]

transmit pipe

Definition at line 79 of file SerialPipe.h.