simpletext library v0.8 Compact variations of put/get write/read and print/scan for smaller program sizes

- Main Page
- Data Structures
- Files

- File List
- Globals

Data Structures | Typedefs | Functions
serial.h File Reference
`#include "simpletext.h"`

Go to the source code of this file.

## Data Structures
struct | serial_info

## Typedefs
typedef struct serial_info | Serial_t
typedef text_t | serial

## Functions
serial * | serial_open (int rxpin, int txpin, int mode, int baudrate)
void | serial_close (serial *device)
int | serial_rxChar (serial *device)
int | serial_txChar (serial *device, int txbyte)

## Detailed Description

Defines serial module

Copyright (c) 2013, Parallax Inc. Written by Steve Denson Symbol naming decided by Parallax

## Function Documentation

void serial_close | ( | serial * | device | ) |

Close device. Equivalent to a stop function without stopping a cog.

Parameters

  device | is a previously open/started terminal device.

serial* serial_open | ( | int | rxpin,
|  | int | txpin,
|  | int | mode,
|  | int | baudrate
| ) |  |

Initializes the simple serial terminal. Equivalent to a start function which runs assembly in a cog.

Parameters

  rxpin | is pin number for receive input
  txpin | is pin number for transmit output
  mode | is unused mode field (for FdSerial compatibility)
  baudrate | is frequency of bits ... 115200, 57600, etc...

Returns
  device term pointer for use with other functions.

int serial_rxChar | ( | serial * | device | ) |

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

Parameters

  device | is a previously open/started terminal device.

Returns
  receive byte 0 to 0xff or -1 if none available

int serial_txChar | ( | serial * | device,
|  | int | txbyte
| ) |  |

Sends a byte on the transmit queue.

Parameters

  device | is a previously open/started terminal device.
  txbyte | is byte to send.

Returns
  waits for and returns received byte if mode is 8