This class provides an API to communicate with a u-blox GNSS chip. The files here were originally part of the C027_Support library (https://developer.mbed.org/teams/ublox/code/C027_Support/ at revision 138:dafbbf31bf76) but have been separated out, primarily for use on the u-blox C030 board where the cellular interace portion of the C027_Support library will instead be provided through the new mbed Cellular API.

Dependents:   example-ublox-at-cellular-interface-ext example-low-power-sleep example-C030-out-of-box-demo example-C030-out-of-box-demo ... more

Embed: (wiki syntax)

« Back to documentation index

SerialPipe Class Reference

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

#include <serial_pipe.h>

Inherited by GnssSerial.

Public Member Functions

 SerialPipe (PinName tx, PinName rx, int baudrate, 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 26 of file serial_pipe.h.


Constructor & Destructor Documentation

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

Constructor.

Parameters:
txthe trasmitting pin
rxthe receiving pin
baudatethe serial baud rate
rxSizethe size of the receiving buffer
txSizethe size of the transmitting buffer

Definition at line 18 of file serial_pipe.cpp.

~SerialPipe ( void   ) [virtual]

Destructor.

Definition at line 28 of file serial_pipe.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 113 of file serial_pipe.cpp.

int getc ( void   )

receive one character from the serial port (blocking)

Parameters:
thecharacter received

Definition at line 104 of file serial_pipe.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 47 of file serial_pipe.cpp.

int putc ( int  c )

send a character (blocking)

Parameters:
cthe character to send
Returns:
c

Definition at line 40 of file serial_pipe.cpp.

int readable ( void   )

check if readable

Returns:
the size available in the buffer.

Definition at line 99 of file serial_pipe.cpp.

void rxIrqBuf ( void   ) [protected]

receive interrupt routine

Definition at line 118 of file serial_pipe.cpp.

void txCopy ( void   ) [protected]

move bytes to hardware

Definition at line 70 of file serial_pipe.cpp.

void txIrqBuf ( void   ) [protected]

transmit interrupt woutine

Definition at line 78 of file serial_pipe.cpp.

void txStart ( void   ) [protected]

start transmission helper

Definition at line 87 of file serial_pipe.cpp.

int writeable ( void   )

check if writable return the number of free bytes

Definition at line 35 of file serial_pipe.cpp.


Field Documentation

Pipe<char> _pipeRx [protected]

receive pipe

Definition at line 96 of file serial_pipe.h.

Pipe<char> _pipeTx [protected]

transmit pipe

Definition at line 97 of file serial_pipe.h.