#include "serapi_t.h"
Go to the source code of this file.
Functions | |
| unsigned int | initSerial (int port) |
| This function inits the serial port. More... | |
| void | deinitSerial (int port) |
| After work done call this function. More... | |
| void | setParam (int port, unsigned long baudrate, unsigned int databits, char parity, unsigned int stopbits, unsigned int flowCtrl) |
| This funtion sets important parameters like baudrate and so on. More... | |
| void | enableRS485 (int port, unsigned int activityMode) |
| This funtion enables the RS485 mode. More... | |
| byte | blockedSend (int port, byte b) |
| Puts a byte into the output buffer. More... | |
| bool | unblockedSend (int port, byte b) |
| Place a byte in the output buffer if there is room. More... | |
| unsigned int | sendBlock (int port, byte far *dataBlock, unsigned int length) |
| This function writes a block of data to the serial port buffer. More... | |
| byte | blockedReceive (int port) |
| Reads a byte from the receiver buffer. More... | |
| byte | unblockedReceive (int port) |
| Returns the next byte available in the receive buffer, without removing it from the buffer. More... | |
| bool | byteAvail () |
| Returns true if the unblockedReceive function determined that there's a byte. More... | |
| unsigned int | receiveBlock (int port, byte far *dataBlock, unsigned int length) |
| Read up to a maximum number of bytes from the serial port. More... | |
| void | flushOutBuffer (int port) |
| Wait for all output in the output buffer to be transmitted. More... | |
| void | deleteOutBuffer (int port) |
| Remove all data from the output buffer. More... | |
| void | deleteInBuffer (int port) |
| Remove all data from the receive buffer. More... | |
| statusPtr | getStatus (int port, byte statByte) |
| Returns the status of the seril port. More... | |
This API was developed for easy handling the Fossil functions of the SC12 by Beck GmbH. The code was inspired from a snippet which I found in the examples delivered with the original API descriptions from Beck.
This API contains functions for initializing and deinitializing a serial port. Furthermore there are functions for setting parameters of the interface like baudrate, parity etc. and for sending and receiving bytes or whole data blocks.
Definition in file serapi.h.
|
|
Reads a byte from the receiver buffer. Wait for a byte to arrive if none is available.
|
|
|
Puts a byte into the output buffer. If there's room in the output buffer then the functions returns to the caller. Otherwise it waits for room. This can be dangerous when used in combination with flow control.
|
|
|
Returns true if the unblockedReceive function determined that there's a byte. Attention: You shouldn't use this function for testing whether there's a byte. For this use the
|
|
|
After work done call this function.
|
|
|
Remove all data from the receive buffer.
|
|
|
Remove all data from the output buffer.
|
|
|
This funtion enables the RS485 mode.
|
|
|
Wait for all output in the output buffer to be transmitted.
|
|
|
Returns the status of the seril port. If no statByte is given (statByte == NO_STATUS) the functions fills the status struct with the actual values getting from the serial port. If a statByte is given the functions ignores the serial port and fills the status struct with the values computing from the statByte.
|
|
|
This function inits the serial port. You must call this function first, if you want to work with one of the ports.
|
|
|
Read up to a maximum number of bytes from the serial port. This is an unblocking read.
|
|
|
This function writes a block of data to the serial port buffer. It's unknown whether this is blocking or unblocking.
|
|
|
This funtion sets important parameters like baudrate and so on.
If no valid baudrate is given, then 2400 is assumed. If no valid databits are given, then 8 databits are assumed. If no valid parity is given, then no parity is assumed. If no valid stopit is given, then one stopbit is assumed. |
|
|
Returns the next byte available in the receive buffer, without removing it from the buffer. After calling this function you have to call the byteAvail function to test if the returned byte is really the byte.
|
|
|
Place a byte in the output buffer if there is room. Do not wait for the byte actually being transmitted.
|
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001