PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Functions
fdserial.c File Reference
#include <stdlib.h>
#include "fdserial.h"
+ Include dependency graph for fdserial.c:

Go to the source code of this file.

Functions

fdserialfdserial_open (int rxpin, int txpin, int mode, int baudrate)
 Open a full duplex serial connection. More...
 
void fdserial_close (fdserial *term)
 Stop stops the cog running the native assembly driver. More...
 
int fdserial_txEmpty (fdserial *term)
 Check if the transmit buffer is empty. More...
 
int fdserial_rxCheck (fdserial *term)
 Gets a byte from the receive buffer if available, but does not wait if there's nothing in the buffer. More...
 
int fdserial_rxChar (fdserial *term)
 Get a byte from the receive buffer, or if it's emtpy, wait until a byte is received. More...
 
int fdserial_txChar (fdserial *term, int txbyte)
 Send a byte by adding it to the transmit buffer. More...
 

Detailed Description

Full Duplex Serial adapter module.

Copyright (c) 2008-2013, Steve Denson See end of file for terms of use.

Definition in file fdserial.c.

Function Documentation

◆ fdserial_close()

void fdserial_close ( fdserial term)

Stop stops the cog running the native assembly driver.

Parameters
*termDevice ID returned by fdserial_open.

Definition at line 115 of file fdserial.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fdserial_open()

fdserial* fdserial_open ( int  rxpin,
int  txpin,
int  mode,
int  baudrate 
)

Open a full duplex serial connection.

Parameters
rxpinSerial receive input pin number.
txpinSerial transmit output pin number.
modeSet/clear bits to define mode: mode bit 0 = invert rx mode bit 1 = invert tx mode bit 2 = open-drain/source tx mode bit 3 = ignore tx echo on rx
baudrateRate binary values are transmitted, like 115200, 57600,..., 9600 etc.
Returns
fdserial pointer for use as an identifier for fdserial and simpletext library functions that have fdserial or text_t parameter types.
Examples
FdSerial_Demo.c, Hello_Demo.cpp, and Spin2Dat_Demo.cpp.

Definition at line 20 of file fdserial.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fdserial_rxChar()

int fdserial_rxChar ( fdserial term)

Get a byte from the receive buffer, or if it's emtpy, wait until a byte is received.

Parameters
*termDevice ID returned by fdserial_open.

Oldest byte (0 to 255) in receive buffer

Definition at line 164 of file fdserial.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fdserial_rxCheck()

int fdserial_rxCheck ( fdserial term)

Gets a byte from the receive buffer if available, but does not wait if there's nothing in the buffer.

Parameters
*termDevice ID returned by fdserial_open.
Returns
Oldest byte (0 to 255) in receive buffer, or -1 if buffer is empty.

Definition at line 146 of file fdserial.c.

+ Here is the caller graph for this function:

◆ fdserial_txChar()

int fdserial_txChar ( fdserial term,
int  txbyte 
)

Send a byte by adding it to the transmit buffer.

Parameters
*termDevice ID returned by fdserial_open.
txbyteis byte to send.
Returns
The byte that was sent, or returns the byte that was received if mode bit 3 was set in the fdserial_open call.

Definition at line 176 of file fdserial.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fdserial_txEmpty()

int fdserial_txEmpty ( fdserial term)

Check if the transmit buffer is empty.

Parameters
*termDevice ID returned by fdserial_open.
Returns
non-zero if transmit buffer is empty.

Definition at line 135 of file fdserial.c.

+ Here is the caller graph for this function: