- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# io.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   io.h
    00020
    00021   MakingThings
    00022 */
    00023
    00024 #ifndef IO_H
    00025 #define IO_H
    00026
    00027 #include "types.h"
    00028
    00029 #define IO_OUTPUT 1
    00030 #define IO_INPUT 0
    00031
    00032 int Io_Start( int index, bool lock );
    00033 int Io_Stop( int index );
    00034 bool Io_GetActive( int index );
    00035 int Io_StartBits( longlong bits, bool lock );
    00036 int Io_StopBits( longlong bits );
    00037
    00038 int Io_SetDirection( int index, bool output );
    00039 bool Io_GetDirection( int index );
    00040
    00041 int Io_SetPortA( int value );
    00042 int Io_GetPortA( void );
    00043 int Io_SetPortB( int value );
    00044 int Io_GetPortB( void );
    00045 int Io_SetPortAMask( int value );
    00046 int Io_GetPortAMask( void );
    00047 int Io_SetPortBMask( int value );
    00048 int Io_GetPortBMask( void );
    00049
    00050 int Io_SetValue( int index, bool value );
    00051 bool Io_GetValue( int index );
    00052 int Io_SetPeripheralA( int index );
    00053 int Io_SetPeripheralB( int index );
    00054 int Io_SetPio( int index, bool enable );
    00055 bool Io_GetPio( int index );
    00056 int Io_SetPullup( int index, bool enable );
    00057 bool Io_GetPullup( int index );
    00058
    00059 void Io_SetDirectionBits( longlong bits, bool output );
    00060 void Io_SetValueBits( longlong bits, longlong value );
    00061 int Io_SetPeripheralABits( longlong bits );
    00062 int Io_SetPeripheralBBits( longlong bits );
    00063 void Io_SetPioBits( longlong bits, bool enable );
    00064 void Io_SetPullupBits( longlong bits, bool enable );
    00065
    00066 longlong Io_GetValueBits( void );
    00067 longlong Io_GetPullupBits( void );
    00068 longlong Io_GetPioBits( void );
    00069 longlong Io_GetDirectionBits( void );
    00070
    00071 const char* IoOsc_GetName( void );
    00072 int IoOsc_ReceiveMessage( int channel, char* message, int length );
    00073
    00074 /**
    00075   \defgroup IoIndices IO Indices
    00076   Indices (0-63) for each of the processor's IO lines.  PA0-PA31 are represented
    00077   by indices 0 - 31, PB0-PB31 by indices 32 - 63.
    00078   \ingroup Io
    00079   @{
    00080 */
    00081
    00082 /** IO 0, Port A */
    00083 #define IO_PA00  0
    00084 /** IO 1, Port A */
    00085 #define IO_PA01  1
    00086 /** IO 2, Port A */
    00087 #define IO_PA02  2
    00088 /** IO 3, Port A */
    00089 #define IO_PA03  3
    00090 /** IO 4, Port A */
    00091 #define IO_PA04  4
    00092 /** IO 5, Port A */
    00093 #define IO_PA05  5
    00094 /** IO 6, Port A */
    00095 #define IO_PA06  6
    00096 /** IO 7, Port A */
    00097 #define IO_PA07  7
    00098 /** IO 8, Port A */
    00099 #define IO_PA08  8
    00100 /** IO 9, Port A */
    00101 #define IO_PA09  9
    00102 /** IO 10, Port A */
    00103 #define IO_PA10 10
    00104 /** IO 11, Port A */
    00105 #define IO_PA11 11
    00106 /** IO 12, Port A */
    00107 #define IO_PA12 12
    00108 /** IO 113, Port A */
    00109 #define IO_PA13 13
    00110 /** IO 14, Port A */
    00111 #define IO_PA14 14
    00112 /** IO 15, Port A */
    00113 #define IO_PA15 15
    00114 /** IO 16, Port A */
    00115 #define IO_PA16 16
    00116 /** IO 17, Port A */
    00117 #define IO_PA17 17
    00118 /** IO 18, Port A */
    00119 #define IO_PA18 18
    00120 /** IO 19, Port A */
    00121 #define IO_PA19 19
    00122 /** IO 20, Port A */
    00123 #define IO_PA20 20
    00124 /** IO 21, Port A */
    00125 #define IO_PA21 21
    00126 /** IO 22, Port A */
    00127 #define IO_PA22 22
    00128 /** IO 23, Port A */
    00129 #define IO_PA23 23
    00130 /** IO 24, Port A */
    00131 #define IO_PA24 24
    00132 /** IO 25, Port A */
    00133 #define IO_PA25 25
    00134 /** IO 26, Port A */
    00135 #define IO_PA26 26
    00136 /** IO 27, Port A */
    00137 #define IO_PA27 27
    00138 /** IO 28, Port A */
    00139 #define IO_PA28 28
    00140 /** IO 29, Port A */
    00141 #define IO_PA29 29
    00142 /** IO 30, Port A */
    00143 #define IO_PA30 30
    00144 /** IO 31, Port A */
    00145 #define IO_PA31 31
    00146
    00147 /** IO 0, Port B */
    00148 #define IO_PB00 ( 32 +  0 )
    00149 /** IO 1, Port B */
    00150 #define IO_PB01 ( 32 +  1 )
    00151 /** IO 2, Port B */
    00152 #define IO_PB02 ( 32 +  2 )
    00153 /** IO 3, Port B */
    00154 #define IO_PB03 ( 32 +  3 )
    00155 /** IO 4, Port B */
    00156 #define IO_PB04 ( 32 +  4 )
    00157 /** IO 5, Port B */
    00158 #define IO_PB05 ( 32 +  5 )
    00159 /** IO 6, Port B */
    00160 #define IO_PB06 ( 32 +  6 )
    00161 /** IO 7, Port B */
    00162 #define IO_PB07 ( 32 +  7 )
    00163 /** IO 8, Port B */
    00164 #define IO_PB08 ( 32 +  8 )
    00165 /** IO 9, Port B */
    00166 #define IO_PB09 ( 32 +  9 )
    00167 /** IO 10, Port B */
    00168 #define IO_PB10 ( 32 + 10 )
    00169 /** IO 11, Port B */
    00170 #define IO_PB11 ( 32 + 11 )
    00171 /** IO 12, Port B */
    00172 #define IO_PB12 ( 32 + 12 )
    00173 /** IO 13, Port B */
    00174 #define IO_PB13 ( 32 + 13 )
    00175 /** IO 14, Port B */
    00176 #define IO_PB14 ( 32 + 14 )
    00177 /** IO 15, Port B */
    00178 #define IO_PB15 ( 32 + 15 )
    00179 /** IO 16, Port B */
    00180 #define IO_PB16 ( 32 + 16 )
    00181 /** IO 17, Port B */
    00182 #define IO_PB17 ( 32 + 17 )
    00183 /** IO 18, Port B */
    00184 #define IO_PB18 ( 32 + 18 )
    00185 /** IO 19, Port B */
    00186 #define IO_PB19 ( 32 + 19 )
    00187 /** IO 20, Port B */
    00188 #define IO_PB20 ( 32 + 20 )
    00189 /** IO 21, Port B */
    00190 #define IO_PB21 ( 32 + 21 )
    00191 /** IO 22, Port B */
    00192 #define IO_PB22 ( 32 + 22 )
    00193 /** IO 23, Port B */
    00194 #define IO_PB23 ( 32 + 23 )
    00195 /** IO 24, Port B */
    00196 #define IO_PB24 ( 32 + 24 )
    00197 /** IO 25, Port B */
    00198 #define IO_PB25 ( 32 + 25 )
    00199 /** IO 26, Port B */
    00200 #define IO_PB26 ( 32 + 26 )
    00201 /** IO 27, Port B */
    00202 #define IO_PB27 ( 32 + 27 )
    00203 /** IO 28, Port B */
    00204 #define IO_PB28 ( 32 + 28 )
    00205 /** IO 29, Port B */
    00206 #define IO_PB29 ( 32 + 29 )
    00207 /** IO 30, Port B */
    00208 #define IO_PB30 ( 32 + 30 )
    00209 /** IO 31, Port B */
    00210 #define IO_PB31 ( 32 + 31 )
    00211
    00212 /* @} */
    00213
    00214 /**
    00215 \defgroup IoBits IO Bits
    00216   The values to use to create a mask to pass into any of the \b Bits style functions.
    00217   Your mask values need to be of type longlong since it needs to represent 64 bits,
    00218   for the 64 IO lines.
    00219
    00220   \b Example
    00221
    00222   \code
    00223   longlong mymask = 0;
    00224   mymask |= (IO_PA00_BIT | IO_PA03_BIT | IO_PA11_BIT);
    00225   // now disable the pullups for lines PA00, PA03, and PA11
    00226   Io_PullupDisableBits( mymask );
    00227   \endcode
    00228 \ingroup Io
    00229 @{
    00230 */
    00231
    00232 /** IO 0, Port A */
    00233 #define IO_PA00_BIT 1LL<<0x00
    00234 /** IO 1, Port A */
    00235 #define IO_PA01_BIT 1LL<<0x01
    00236 /** IO 2, Port A */
    00237 #define IO_PA02_BIT 1LL<<0x02
    00238 /** IO 3, Port A */
    00239 #define IO_PA03_BIT 1LL<<0x03
    00240 /** IO 4, Port A */
    00241 #define IO_PA04_BIT 1LL<<0x04
    00242 /** IO 5, Port A */
    00243 #define IO_PA05_BIT 1LL<<0x05
    00244 /** IO 6, Port A */
    00245 #define IO_PA06_BIT 1LL<<0x06
    00246 /** IO 7, Port A */
    00247 #define IO_PA07_BIT 1LL<<0x07
    00248 /** IO 8, Port A */
    00249 #define IO_PA08_BIT 1LL<<0x08
    00250 /** IO 9, Port A */
    00251 #define IO_PA09_BIT 1LL<<0x09
    00252 /** IO 10, Port A */
    00253 #define IO_PA10_BIT 1LL<<0x0A
    00254 /** IO 11, Port A */
    00255 #define IO_PA11_BIT 1LL<<0x0B
    00256 /** IO 12, Port A */
    00257 #define IO_PA12_BIT 1LL<<0x0C
    00258 /** IO 13, Port A */
    00259 #define IO_PA13_BIT 1LL<<0x0D
    00260 /** IO 14, Port A */
    00261 #define IO_PA14_BIT 1LL<<0x0E
    00262 /** IO 15, Port A */
    00263 #define IO_PA15_BIT 1LL<<0x0F
    00264 /** IO 16, Port A */
    00265 #define IO_PA16_BIT 1LL<<0x10
    00266 /** IO 17, Port A */
    00267 #define IO_PA17_BIT 1LL<<0x11
    00268 /** IO 18, Port A */
    00269 #define IO_PA18_BIT 1LL<<0x12
    00270 /** IO 19, Port A */
    00271 #define IO_PA19_BIT 1LL<<0x13
    00272 /** IO 20, Port A */
    00273 #define IO_PA20_BIT 1LL<<0x14
    00274 /** IO 21, Port A */
    00275 #define IO_PA21_BIT 1LL<<0x15
    00276 /** IO 22, Port A */
    00277 #define IO_PA22_BIT 1LL<<0x16
    00278 /** IO 23, Port A */
    00279 #define IO_PA23_BIT 1LL<<0x17
    00280 /** IO 24, Port A */
    00281 #define IO_PA24_BIT 1LL<<0x18
    00282 /** IO 25, Port A */
    00283 #define IO_PA25_BIT 1LL<<0x19
    00284 /** IO 26, Port A */
    00285 #define IO_PA26_BIT 1LL<<0x1A
    00286 /** IO 27, Port A */
    00287 #define IO_PA27_BIT 1LL<<0x1B
    00288 /** IO 28, Port A */
    00289 #define IO_PA28_BIT 1LL<<0x1C
    00290 /** IO 29, Port A */
    00291 #define IO_PA29_BIT 1LL<<0x1D
    00292 /** IO 30, Port A */
    00293 #define IO_PA30_BIT 1LL<<0x1E
    00294 /** IO 31, Port A */
    00295 #define IO_PA31_BIT 1LL<<0x1F
    00296
    00297 /** IO 0, Port B */
    00298 #define IO_PB00_BIT 1LL<<0x20
    00299 /** IO 1, Port B */
    00300 #define IO_PB01_BIT 1LL<<0x21
    00301 /** IO 2, Port B */
    00302 #define IO_PB02_BIT 1LL<<0x22
    00303 /** IO 3, Port B */
    00304 #define IO_PB03_BIT 1LL<<0x23
    00305 /** IO 4, Port B */
    00306 #define IO_PB04_BIT 1LL<<0x24
    00307 /** IO 5, Port B */
    00308 #define IO_PB05_BIT 1LL<<0x25
    00309 /** IO 6, Port B */
    00310 #define IO_PB06_BIT 1LL<<0x26
    00311 /** IO 7, Port B */
    00312 #define IO_PB07_BIT 1LL<<0x27
    00313 /** IO 8, Port B */
    00314 #define IO_PB08_BIT 1LL<<0x28
    00315 /** IO 9, Port B */
    00316 #define IO_PB09_BIT 1LL<<0x29
    00317 /** IO 10, Port B */
    00318 #define IO_PB10_BIT 1LL<<0x2A
    00319 /** IO 11, Port B */
    00320 #define IO_PB11_BIT 1LL<<0x2B
    00321 /** IO 12, Port B */
    00322 #define IO_PB12_BIT 1LL<<0x2C
    00323 /** IO 13, Port B */
    00324 #define IO_PB13_BIT 1LL<<0x2D
    00325 /** IO 14, Port B */
    00326 #define IO_PB14_BIT 1LL<<0x2E
    00327 /** IO 15, Port B */
    00328 #define IO_PB15_BIT 1LL<<0x2F
    00329 /** IO 16, Port B */
    00330 #define IO_PB16_BIT 1LL<<0x30
    00331 /** IO 17, Port B */
    00332 #define IO_PB17_BIT 1LL<<0x31
    00333 /** IO 18, Port B */
    00334 #define IO_PB18_BIT 1LL<<0x32
    00335 /** IO 19, Port B */
    00336 #define IO_PB19_BIT 1LL<<0x33
    00337 /** IO 20, Port B */
    00338 #define IO_PB20_BIT 1LL<<0x34
    00339 /** IO 21, Port B */
    00340 #define IO_PB21_BIT 1LL<<0x35
    00341 /** IO 22, Port B */
    00342 #define IO_PB22_BIT 1LL<<0x36
    00343 /** IO 23, Port B */
    00344 #define IO_PB23_BIT 1LL<<0x37
    00345 /** IO 24, Port B */
    00346 #define IO_PB24_BIT 1LL<<0x38
    00347 /** IO 25, Port B */
    00348 #define IO_PB25_BIT 1LL<<0x39
    00349 /** IO 26, Port B */
    00350 #define IO_PB26_BIT 1LL<<0x3A
    00351 /** IO 27, Port B */
    00352 #define IO_PB27_BIT 1LL<<0x3B
    00353 /** IO 28, Port B */
    00354 #define IO_PB28_BIT 1LL<<0x3C
    00355 /** IO 29, Port B */
    00356 #define IO_PB29_BIT 1LL<<0x3D
    00357 /** IO 30, Port B */
    00358 #define IO_PB30_BIT 1LL<<0x3E
    00359 /** IO 31, Port B */
    00360 #define IO_PB31_BIT 1LL<<0x3F
    00361
    00362
    00363 /**
    00364 @}
    00365 */
    00366
    00367 #endif

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.