fdserial library  v0.85
Functions for connecting with full duplex serial devices
Data Structures | Macros | Typedefs | Functions
fdserial.h File Reference

Full Duplex Serial adapter API definition. More...

#include "simpletext.h"

Go to the source code of this file.

Data Structures

struct  fdserial_struct
 

Macros

#define FDSERIAL_BUFF_MASK   0x3f
 
#define FDSERIAL_MODE_NONE   0
 
#define FDSERIAL_MODE_INVERT_RX   1
 
#define FDSERIAL_MODE_INVERT_TX   2
 
#define FDSERIAL_MODE_OPENDRAIN_TX   4
 
#define FDSERIAL_MODE_IGNORE_TX_ECHO   8
 

Typedefs

typedef text_t fdserial
 
typedef struct fdserial_struct fdserial_st
 

Functions

fdserial * fdserial_open (int rxpin, int txpin, int mode, int baudrate)
 Initializes and starts native assembly driver in a cog. More...
 
void fdserial_close (fdserial *term)
 Stop stops the cog running the native assembly driver.
 
int fdserial_rxCheck (fdserial *term)
 Gets a byte from the receive queue if available function does not block. More...
 
void fdserial_rxFlush (fdserial *term)
 Empties the receive queue.
 
int fdserial_rxReady (fdserial *term)
 Find out if a byte is ready in the receive buffer. The function does not block. More...
 
int fdserial_rxTime (fdserial *term, int ms)
 Gets a byte from the receive queue if available by timeout function blocks if no recieve for ms timeout. More...
 
int fdserial_rxChar (fdserial *term)
 Waits for a byte from the receive queue. blocks until somehting is ready. More...
 
int fdserial_txChar (fdserial *term, int txbyte)
 Sends a byte on the transmit queue. More...
 
int fdserial_txEmpty (fdserial *term)
 Find out if the tx queue is empty. More...
 
void fdserial_txFlush (fdserial *term)
 Flush the transmit queue.
 

Detailed Description

Full Duplex Serial adapter API definition.

Author
Steve Denson
Version
0.85

Macro Definition Documentation

#define FDSERIAL_BUFF_MASK   0x3f

Defines buffer length. hard coded in asm driver ... s/b bigger

#define FDSERIAL_MODE_NONE   0

Defines mode bits 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

Typedef Documentation

typedef struct fdserial_struct fdserial_st

Defines fdserial interface struct 9 contiguous longs + buffers

Function Documentation

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

Initializes and starts native assembly driver in a cog.

Parameters
rxpinis pin number for receive input
txpinis pin number for transmit output
modeis interface mode
baudrateis frequency of bits ... 115200, 57600, etc...
Returns
non-zero on success
int fdserial_rxChar ( fdserial *  term)

Waits for a byte from the receive queue. blocks until somehting is ready.

Returns
received byte.
int fdserial_rxCheck ( fdserial *  term)

Gets a byte from the receive queue if available function does not block.

Returns
receive byte 0 to 0xff or -1 if none available
int fdserial_rxReady ( fdserial *  term)

Find out if a byte is ready in the receive buffer. The function does not block.

Returns
non-zero if byte ready. Does not return received byte.
int fdserial_rxTime ( fdserial *  term,
int  ms 
)

Gets a byte from the receive queue if available by timeout function blocks if no recieve for ms timeout.

Parameters
msis number of milliseconds to wait for a char
Returns
receive byte 0 to 0xff or -1 if none available
int fdserial_txChar ( fdserial *  term,
int  txbyte 
)

Sends a byte on the transmit queue.

Parameters
txbyteis byte to send.
Returns
waits for and returns received byte if mode is 8
int fdserial_txEmpty ( fdserial *  term)

Find out if the tx queue is empty.

Returns
non-zero if tx buffer is empty.