MakingThings
  • Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

serial.h

00001 /*********************************************************************************
00002 
00003  Copyright 2006-2008 MakingThings
00004 
00005  Licensed under the Apache License, 
00006  Version 2.0 (the "License"); you may not use this file except in compliance 
00007  with the License. You may obtain a copy of the License at
00008 
00009  http://www.apache.org/licenses/LICENSE-2.0 
00010  
00011  Unless required by applicable law or agreed to in writing, software distributed
00012  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
00013  CONDITIONS OF ANY KIND, either express or implied. See the License for
00014  the specific language governing permissions and limitations under the License.
00015 
00016 *********************************************************************************/
00017 
00018 /*
00019   serial.h
00020   MakingThings
00021 */
00022 
00023 #ifndef SERIAL_H
00024 #define SERIAL_H
00025 
00026 #include "types.h"
00027 /** Index to be used to specify serial port 0 \ingroup serial */
00028 #define SERIAL_0 0
00029 /** Index to be used to specify serial port 1 \ingroup serial */
00030 #define SERIAL_1 1
00031 
00032 
00033 int Serial_SetActive( int index, int state );
00034 bool Serial_GetActive( int index );
00035 
00036 int Serial_SetBaud( int index, int baud );
00037 int Serial_SetBits( int index, int bits );
00038 int Serial_SetParity( int index, int parity );
00039 int Serial_SetStopBits( int index, int stop );
00040 int Serial_SetHardwareHandshake( int index, int hardwareHandshake );
00041 int Serial_SetChar( int index, int character );
00042 
00043 int Serial_GetBaud( int index );
00044 int Serial_GetBits( int index );
00045 int Serial_GetParity( int index );
00046 int Serial_GetStopBits( int index );
00047 int Serial_GetHardwareHandshake( int index );
00048 int Serial_GetReadable( int index );
00049 int Serial_GetChar( int index );
00050 
00051 int Serial_Write( int index, uchar *buffer, int count, int timeout );
00052 int Serial_Read( int index, uchar* buffer, int count, int timeout );
00053 
00054 void Serial_Flush( int index );
00055 void Serial_ClearErrors( int index );
00056 bool Serial_GetErrors(int index,  bool* overrun, bool* frame, bool* parity );
00057 void Serial_StartBreak( int index );
00058 void Serial_StopBreak( int index );
00059 
00060 /* OSC Interface */
00061 const char* SerialOsc_GetName( void );
00062 int SerialOsc_ReceiveMessage( int channel, char* message, int length );
00063 
00064 #endif // SERIAL_H

The Make Controller Kit is an open source project maintained by MakingThings.
MakingThings code is released under the Apache 2.0 license.
Bug tracker, development wiki and status can be found at http://dev.makingthings.com.
This document was last updated on 18 May 2009.