PropWare
C++ objects and CMake build system for Parallax Propeller
|
#include <full_duplex_serial.h>
Public Member Functions | |
void | Start (int Rxpin, int Txpin, int Mode, int Baudrate) |
void | Stop (void) |
void | GetFlush (void) |
int | Get (const int timeout=-1) |
void | Put (const char Txbyte) |
void | Put (const char *string) |
int | PutDec (int Value) |
This driver, once started, implements a serial port in one cog.
Hardware: To read 3.3v signals just connect the signal directly to any I/O pin. To read a 5v signal connect it to any I/O pin through a 3.3kOhm (or higher) resistor.
Software: The maximum standard baud rate on an 80MHz clock is 230400 baud.
This object is derived from FullDuplexSerial.spin v1.2.1 by Chip Gracey, Jeff Martin, and Daniel Harris. Thanks!
Copyright (c) 2013 Kenneth Bedolla (libpr) opel ler@k enne thbed olla .com
Definition at line 43 of file full_duplex_serial.h.
int libpropeller::FullDuplexSerial::Get | ( | const int | timeout = -1 | ) |
Receive a byte of data.
If there are bytes in the buffer this function returns immediately. Otherwise, it waits as specified by the timeout parameter.
timeout | The maximum duration to wait for a byte in milliseconds. A timeout of -1 indicates no wait. |
Definition at line 120 of file full_duplex_serial.h.
void libpropeller::FullDuplexSerial::GetFlush | ( | void | ) |
Clear the receive buffer of all bytes.
After calling this function the receive buffer has 0 bytes in it, and a call to Get() without a timeout will wait until a byte is received.
Definition at line 106 of file full_duplex_serial.h.
void libpropeller::FullDuplexSerial::Put | ( | const char | Txbyte | ) |
Transmit a byte of data.
Txbyte | the byte to send. |
Definition at line 138 of file full_duplex_serial.h.
void libpropeller::FullDuplexSerial::Put | ( | const char * | string | ) |
Transmit a C string.
Note: the null at the end is not transmitted.
string | The null terminated string to transmit. |
Definition at line 154 of file full_duplex_serial.h.
int libpropeller::FullDuplexSerial::PutDec | ( | int | Value | ) |
Transmit the decimal representation of a number.
Value | the number whose value to print as a decimal |
Definition at line 175 of file full_duplex_serial.h.
void libpropeller::FullDuplexSerial::Start | ( | int | Rxpin, |
int | Txpin, | ||
int | Mode, | ||
int | Baudrate | ||
) |
Start serial driver in new cog.
Rxpin | Input to the Propeller |
Txpin | Output from the Propeller |
Mode | Bitwise mode configuration variable:
|
Baudrate | Any rate will work, up to the maximum baud |
Definition at line 57 of file full_duplex_serial.h.
void libpropeller::FullDuplexSerial::Stop | ( | void | ) |
Stop the serial driver (if running) and free a cog.
Definition at line 83 of file full_duplex_serial.h.