Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: example-ublox-at-cellular-interface-ext example-low-power-sleep example-C030-out-of-box-demo example-C030-out-of-box-demo ... more
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:
-
tx the trasmitting pin rx the receiving pin baudate the serial baud rate rxSize the size of the receiving buffer txSize the 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:
-
pointer to the buffer to read. length number of bytes to read blocking true 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:
-
the character received
Definition at line 104 of file serial_pipe.cpp.
int put | ( | const void * | buffer, |
int | length, | ||
bool | blocking | ||
) |
send a buffer
- Parameters:
-
buffer the buffer to send length the size of the buffer to send blocking,if true 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:
-
c the 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
receive pipe
Definition at line 96 of file serial_pipe.h.
transmit pipe
Definition at line 97 of file serial_pipe.h.
Generated on Tue Jul 12 2022 14:18:20 by
