wiringpi 1.0.0-armv6l-linux → 1.0.1-armv6l-linux

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,6 +23,7 @@
23
23
  #include <stdio.h>
24
24
  #include <stdlib.h>
25
25
  #include <stdint.h>
26
+ #include <stdarg.h>
26
27
  #include <string.h>
27
28
  #include <termios.h>
28
29
  #include <unistd.h>
@@ -148,6 +149,25 @@ void serialPuts (int fd, char *s)
148
149
  write (fd, s, strlen (s)) ;
149
150
  }
150
151
 
152
+ /*
153
+ * serialPrintf:
154
+ * Printf over Serial
155
+ *********************************************************************************
156
+ */
157
+
158
+ void serialPrintf (int fd, char *message, ...)
159
+ {
160
+ va_list argp ;
161
+ char buffer [1024] ;
162
+
163
+ va_start (argp, message) ;
164
+ vsnprintf (buffer, 1023, message, argp) ;
165
+ va_end (argp) ;
166
+
167
+ serialPuts (fd, buffer) ;
168
+ }
169
+
170
+
151
171
  /*
152
172
  * serialDataAvail:
153
173
  * Return the number of bytes of data avalable to be read in the serial port
@@ -32,6 +32,7 @@ extern int serialOpen (char *device, int baud) ;
32
32
  extern void serialClose (int fd) ;
33
33
  extern void serialPutchar (int fd, uint8_t c) ;
34
34
  extern void serialPuts (int fd, char *s) ;
35
+ extern void serialPrintf (int fd, char *message, ...) ;
35
36
  extern int serialDataAvail (int fd) ;
36
37
  extern int serialGetchar (int fd) ;
37
38
 
@@ -471,9 +471,6 @@ void digitalWrite (int pin, int value)
471
471
  {
472
472
  int gpioPin ;
473
473
 
474
- if ((pin < 0) || (pin >= NUM_PINS))
475
- return ;
476
-
477
474
  if (gpioPinMode == WPI_MODE_PINS)
478
475
  {
479
476
  if ((pin < 0) || (pin >= NUM_PINS))
@@ -2427,6 +2427,39 @@ fail:
2427
2427
  }
2428
2428
 
2429
2429
 
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
+
2430
2463
 
2431
2464
  /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2432
2465
 
@@ -2715,5 +2748,6 @@ SWIGEXPORT void Init_wiringpi(void) {
2715
2748
  rb_define_module_function(mWiringpi, "serialPuts", _wrap_serialPuts, -1);
2716
2749
  rb_define_module_function(mWiringpi, "serialDataAvail", _wrap_serialDataAvail, -1);
2717
2750
  rb_define_module_function(mWiringpi, "serialGetchar", _wrap_serialGetchar, -1);
2751
+ rb_define_module_function(mWiringpi, "serialPrintf", _wrap_serialPrintf, -1);
2718
2752
  }
2719
2753
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wiringpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: armv6l-linux
7
7
  authors: