//
// ac_serialio.h - serial port functions
//
// Copyright (C) 2006 Nathan (Acorn) Pooley
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License (gpl.txt) for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// You can contact the author, Nathan (Acorn) Pooley, by writing
// to Nathan (Acorn) Pooley, 949 Buckeye Drive, Sunnyvale, CA 94086, USA
// or through the form at http://www.rawbw.com/~acorn/wand/feedback.html
//
//
// Thanks to Gary Frerking for writing the Serial Programming HOWTO at
// http://www.tldp.org/HOWTO/Serial-Programming-HOWTO
// Much of this is based on his descriptions and examples.
//
#ifndef AC_SERIALIO_H
#define AC_SERIALIO_H
//#@DOC@ serial port functions
//###########################################################################
//############################### NOTES #####################################
//###########################################################################
//
// H H OOO W W TTTTT OOO U U SSSS EEEE
// H H O O W W W T O O U U S E
// HHHHH O O W W W T O O U U SSS EEE
// H H O O WWWWW T O O U U S E
// H H OOO W W T OOO UUU SSSS EEEEE
//
// 1) Create an AcSerial structure:
// // first arg is device
// // second arg is baudrate
// AcSerial *s = acSerialCreate("/dev/ttyS0",9600);
//
// 2) By default you will get 1 line each time you read. If instead you want
// to set it up differently call:
//
// // vtime vmin description
// // ----- ---- -----------
// // 0 0 return immediately
// // >0 0 wait until 1 char received, or until timeout
// // 0 >0 wait until vmin chars received
// // >0 >0 wait until vmin chars received, or until vtime
// // elapsed since last char
// // vtime is in 1/10 second.
// //
// acSerialSetMode(s,vtime,vmin);
//
// 3) Open & get the fd by calling
// acSerialOpen(s);
// int fd = acSerialGetFD(s);
//
// 4) Close & free by calling
// acSerialDestroy(s);
//
//###########################################################################
//############################### TYPEDEFS ##################################
//###########################################################################
typedef struct AcSerialRec AcSerial;
//###########################################################################
//############################### PROTOTYPES ################################
//###########################################################################
AcSerial *acSerialCreate(const char *dev, int baudrate);
void acSerialDestroy(AcSerial *sio);
int acSerialSetNonCanonical(AcSerial *sio, int vtime, int vmin);
int acSerialSetBaud(AcSerial *sio, int baudrate);
int acSerialOpen(AcSerial *sio);
void acSerialClose(AcSerial *sio);
int acSerialGetFD(AcSerial *sio);
#endif // AC_SERIALIO_H
|
This file Copyright (C) 2006 by Nathan (Acorn) Pooley
Go to TOP Wand page
Go to Acorn's personal webpage
Go to Hogwarts website: www.gotohogwarts.com
Snout: www.snout.org/game
Gadgets of Justice Unlimited
Snout GC (Wiki)
Snout Wiki
File created by do_doc at Wed May 30 03:30:10 PDT 2007