wiringpi 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/wiringpi/wiringPi.c +9 -9
- data/ext/wiringpi/wiringpi_wrap.c +21 -52
- metadata +1 -1
data/ext/wiringpi/wiringPi.c
CHANGED
@@ -59,15 +59,15 @@
|
|
59
59
|
|
60
60
|
// Port function select bits
|
61
61
|
|
62
|
-
#define FSEL_INPT
|
63
|
-
#define FSEL_OUTP
|
64
|
-
#define FSEL_ALT0
|
65
|
-
#define FSEL_ALT0
|
66
|
-
#define FSEL_ALT1
|
67
|
-
#define FSEL_ALT2
|
68
|
-
#define FSEL_ALT3
|
69
|
-
#define FSEL_ALT4
|
70
|
-
#define FSEL_ALT5
|
62
|
+
#define FSEL_INPT 0x0
|
63
|
+
#define FSEL_OUTP 0x1
|
64
|
+
#define FSEL_ALT0 0x4
|
65
|
+
#define FSEL_ALT0 0x4
|
66
|
+
#define FSEL_ALT1 0x5
|
67
|
+
#define FSEL_ALT2 0x6
|
68
|
+
#define FSEL_ALT3 0x7
|
69
|
+
#define FSEL_ALT4 0x3
|
70
|
+
#define FSEL_ALT5 0x2
|
71
71
|
|
72
72
|
// Access from ARM Running Linux
|
73
73
|
// Take from Gerts code. Some of this is not in the manual
|
@@ -1,6 +1,6 @@
|
|
1
1
|
/* ----------------------------------------------------------------------------
|
2
2
|
* This file was automatically generated by SWIG (http://www.swig.org).
|
3
|
-
* Version
|
3
|
+
* Version 2.0.7
|
4
4
|
*
|
5
5
|
* This file is not intended to be easily readable and contains a number of
|
6
6
|
* coding conventions designed to improve portability and efficiency. Do not make
|
@@ -281,7 +281,7 @@
|
|
281
281
|
/*
|
282
282
|
Flags/methods for returning states.
|
283
283
|
|
284
|
-
The SWIG conversion methods, as ConvertPtr, return
|
284
|
+
The SWIG conversion methods, as ConvertPtr, return an integer
|
285
285
|
that tells if the conversion was successful or not. And if not,
|
286
286
|
an error code can be returned (see swigerrors.swg for the codes).
|
287
287
|
|
@@ -831,6 +831,15 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
|
|
831
831
|
|
832
832
|
#include <ruby.h>
|
833
833
|
|
834
|
+
/* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
|
835
|
+
* breaks using rb_intern as an lvalue, as SWIG does. We work around this
|
836
|
+
* issue for now by disabling this.
|
837
|
+
* https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
|
838
|
+
*/
|
839
|
+
#ifdef rb_intern
|
840
|
+
# undef rb_intern
|
841
|
+
#endif
|
842
|
+
|
834
843
|
/* Remove global macros defined in Ruby's win32.h */
|
835
844
|
#ifdef write
|
836
845
|
# undef write
|
@@ -989,7 +998,7 @@ static VALUE _mSWIG = Qnil;
|
|
989
998
|
|
990
999
|
/* Define custom exceptions for errors that do not map to existing Ruby
|
991
1000
|
exceptions. Note this only works for C++ since a global cannot be
|
992
|
-
initialized by a
|
1001
|
+
initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
|
993
1002
|
|
994
1003
|
SWIGINTERN VALUE
|
995
1004
|
getNullReferenceError(void) {
|
@@ -1134,9 +1143,6 @@ void Ruby_Format_OverloadedError(
|
|
1134
1143
|
}
|
1135
1144
|
|
1136
1145
|
/* -----------------------------------------------------------------------------
|
1137
|
-
* See the LICENSE file for information on copyright, usage and redistribution
|
1138
|
-
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
1139
|
-
*
|
1140
1146
|
* rubytracking.swg
|
1141
1147
|
*
|
1142
1148
|
* This file contains support for tracking mappings from
|
@@ -1332,9 +1338,6 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
|
|
1332
1338
|
|
1333
1339
|
|
1334
1340
|
/* -----------------------------------------------------------------------------
|
1335
|
-
* See the LICENSE file for information on copyright, usage and redistribution
|
1336
|
-
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
|
1337
|
-
*
|
1338
1341
|
* rubyrun.swg
|
1339
1342
|
*
|
1340
1343
|
* This file contains the runtime support for Ruby modules
|
@@ -1378,7 +1381,7 @@ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
|
|
1378
1381
|
/* Error manipulation */
|
1379
1382
|
|
1380
1383
|
#define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
|
1381
|
-
#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg)
|
1384
|
+
#define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), "%s", msg)
|
1382
1385
|
#define SWIG_fail goto fail
|
1383
1386
|
|
1384
1387
|
|
@@ -1433,7 +1436,7 @@ static ID swig_call_id = 0;
|
|
1433
1436
|
++swig_virtual_calls;
|
1434
1437
|
# define SWIG_RELEASE_STACK --swig_virtual_calls;
|
1435
1438
|
# define Ruby_DirectorTypeMismatchException(x) \
|
1436
|
-
rb_raise( rb_eTypeError, x ); return c_result;
|
1439
|
+
rb_raise( rb_eTypeError, "%s", x ); return c_result;
|
1437
1440
|
|
1438
1441
|
static unsigned int swig_virtual_calls = 0;
|
1439
1442
|
|
@@ -1525,7 +1528,7 @@ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
|
|
1525
1528
|
downcast methods. */
|
1526
1529
|
if (obj != Qnil) {
|
1527
1530
|
VALUE value = rb_iv_get(obj, "@__swigtype__");
|
1528
|
-
char* type_name = RSTRING_PTR(value);
|
1531
|
+
const char* type_name = RSTRING_PTR(value);
|
1529
1532
|
|
1530
1533
|
if (strcmp(type->name, type_name) == 0) {
|
1531
1534
|
return obj;
|
@@ -1803,7 +1806,7 @@ static VALUE mWiringpi;
|
|
1803
1806
|
#define SWIG_RUBY_THREAD_END_BLOCK
|
1804
1807
|
|
1805
1808
|
|
1806
|
-
#define SWIGVERSION
|
1809
|
+
#define SWIGVERSION 0x020007
|
1807
1810
|
#define SWIG_VERSION SWIGVERSION
|
1808
1811
|
|
1809
1812
|
|
@@ -1838,7 +1841,7 @@ SWIG_ruby_failed(void)
|
|
1838
1841
|
}
|
1839
1842
|
|
1840
1843
|
|
1841
|
-
/*@SWIG:/usr/share/
|
1844
|
+
/*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
|
1842
1845
|
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
|
1843
1846
|
{
|
1844
1847
|
VALUE obj = args[0];
|
@@ -1883,7 +1886,7 @@ SWIG_AsVal_int (VALUE obj, int *val)
|
|
1883
1886
|
}
|
1884
1887
|
|
1885
1888
|
|
1886
|
-
/*@SWIG:/usr/share/
|
1889
|
+
/*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
|
1887
1890
|
SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
|
1888
1891
|
{
|
1889
1892
|
VALUE obj = args[0];
|
@@ -1996,9 +1999,9 @@ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
|
|
1996
1999
|
|
1997
2000
|
|
1998
2001
|
|
1999
|
-
#include "wiringPi.h"
|
2000
|
-
#include "wiringShift.h"
|
2001
|
-
#include "serial.h"
|
2002
|
+
#include "wiringPi.h"
|
2003
|
+
#include "wiringShift.h"
|
2004
|
+
#include "serial.h"
|
2002
2005
|
|
2003
2006
|
SWIGINTERN VALUE
|
2004
2007
|
_wrap_wiringPiSetup(int argc, VALUE *argv, VALUE self) {
|
@@ -2427,39 +2430,6 @@ fail:
|
|
2427
2430
|
}
|
2428
2431
|
|
2429
2432
|
|
2430
|
-
SWIGINTERN VALUE
|
2431
|
-
_wrap_serialPrintf(int argc, VALUE *argv, VALUE self) {
|
2432
|
-
int arg1 ;
|
2433
|
-
char *arg2 = (char *) 0 ;
|
2434
|
-
void *arg3 = 0 ;
|
2435
|
-
int val1 ;
|
2436
|
-
int ecode1 = 0 ;
|
2437
|
-
int res2 ;
|
2438
|
-
char *buf2 = 0 ;
|
2439
|
-
int alloc2 = 0 ;
|
2440
|
-
|
2441
|
-
if (argc < 2) {
|
2442
|
-
rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
|
2443
|
-
}
|
2444
|
-
ecode1 = SWIG_AsVal_int(argv[0], &val1);
|
2445
|
-
if (!SWIG_IsOK(ecode1)) {
|
2446
|
-
SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","serialPrintf", 1, argv[0] ));
|
2447
|
-
}
|
2448
|
-
arg1 = (int)(val1);
|
2449
|
-
res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
|
2450
|
-
if (!SWIG_IsOK(res2)) {
|
2451
|
-
SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","serialPrintf", 2, argv[1] ));
|
2452
|
-
}
|
2453
|
-
arg2 = (char *)(buf2);
|
2454
|
-
serialPrintf(arg1,arg2,arg3);
|
2455
|
-
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
2456
|
-
return Qnil;
|
2457
|
-
fail:
|
2458
|
-
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
|
2459
|
-
return Qnil;
|
2460
|
-
}
|
2461
|
-
|
2462
|
-
|
2463
2433
|
|
2464
2434
|
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
|
2465
2435
|
|
@@ -2748,6 +2718,5 @@ SWIGEXPORT void Init_wiringpi(void) {
|
|
2748
2718
|
rb_define_module_function(mWiringpi, "serialPuts", _wrap_serialPuts, -1);
|
2749
2719
|
rb_define_module_function(mWiringpi, "serialDataAvail", _wrap_serialDataAvail, -1);
|
2750
2720
|
rb_define_module_function(mWiringpi, "serialGetchar", _wrap_serialGetchar, -1);
|
2751
|
-
rb_define_module_function(mWiringpi, "serialPrintf", _wrap_serialPrintf, -1);
|
2752
2721
|
}
|
2753
2722
|
|