Koala Library
|
00001 //--------------------------------------------------------------------------------// 00002 //- KOALA( Koala extension board ) -// 00003 // -// 00004 //- Copyright (C) Julien Tharin, K-Team S.A. 2013 -// 00005 //- This library is free software; you can redistribute it and/or -// 00006 //- modify it under the terms of the GNU Lesser General Public -// 00007 //- License as published by the Free Software Foundation; either -// 00008 //- version 2.1 of the License, or any later version. -// 00009 //- -// 00010 //- This library is distributed in the hope that it will be useful, -// 00011 //- but WITHOUT ANY WARRANTY; without even the implied warranty of -// 00012 //- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// 00013 //- Lesser General Public License for more details. -// 00014 //- -// 00015 //- You should have received a copy of the GNU Lesser General Public -// 00016 //- License along with this library; if not, write to the Free Software -// 00017 //- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// 00018 //- -// 00019 //- __ __ ________ -// 00020 //- K-Team S.A. | |/ /|__ __|___ _____ ___ ___ -// 00021 //- Chemin des Plans-Praz 28, | / __ | | _____|/ _ \| \/ | -// 00022 //- 1337 Vallorbe | | \ | | ____|/ /_\ | | -// 00023 //- Switzerland |__|\__\ |__|______|_/ \_|__|\/|__| -// 00024 //- jtharin@k-team.com tel:+41 24 423 89 56 fax:+41 24 423 8960 -// 00025 //- -// 00026 //--------------------------------------------------------------------------------// 00027 00029 00032 00033 00034 #ifndef __koala_serial__ 00035 #define __koala_serial__ 00036 00037 #include <termio.h> 00038 00039 typedef struct koala_rs232_s { 00040 00042 int fd; 00043 00045 struct termios tios; 00046 00047 } 00048 koala_rs232_t; 00049 00050 00051 extern koala_rs232_t * koala_rs232_open( 00052 const char * name, int baudrate); 00053 00054 extern void koala_rs232_close(koala_rs232_t * rs232 ); 00055 00056 extern int koala_rs232_read(koala_rs232_t * rs232, 00057 char * buf , unsigned int len ); 00058 00059 00060 extern int koala_rs232_readLine_nowait(koala_rs232_t * rs232, char *buffer); 00061 extern int koala_rs232_readLine(koala_rs232_t * rs232, char *buffer); 00062 00063 extern int koala_rs232_write(koala_rs232_t * rs232 , 00064 const char * buf , unsigned int len ); 00065 00066 00067 00068 #endif /* __koala_serial__ */