wiringpi 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,6 +26,8 @@
26
26
  */
27
27
 
28
28
  // Revisions:
29
+ // 2 Jul 2012:
30
+ // Fixed a few more bugs to do with range-checking when in GPIO mode.
29
31
  // 11 Jun 2012:
30
32
  // Fixed some typos.
31
33
  // Added c++ support for the .h file
@@ -43,12 +45,17 @@
43
45
 
44
46
  #include <stdio.h>
45
47
  #include <stdint.h>
48
+ #include <unistd.h>
46
49
  #include <errno.h>
47
50
  #include <string.h>
48
51
  #include <time.h>
49
52
  #include <fcntl.h>
50
53
  #include <sys/time.h>
51
54
  #include <sys/mman.h>
55
+ #include <sys/types.h>
56
+ #include <sys/stat.h>
57
+
58
+
52
59
 
53
60
  #include "wiringPi.h"
54
61
 
@@ -59,15 +66,15 @@
59
66
 
60
67
  // Port function select bits
61
68
 
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
69
+ #define FSEL_INPT 0b000
70
+ #define FSEL_OUTP 0b001
71
+ #define FSEL_ALT0 0b100
72
+ #define FSEL_ALT0 0b100
73
+ #define FSEL_ALT1 0b101
74
+ #define FSEL_ALT2 0b110
75
+ #define FSEL_ALT3 0b111
76
+ #define FSEL_ALT4 0b011
77
+ #define FSEL_ALT5 0b010
71
78
 
72
79
  // Access from ARM Running Linux
73
80
  // Take from Gerts code. Some of this is not in the manual
@@ -135,7 +142,12 @@ static volatile uint32_t *clk ;
135
142
  // So the 3 bits for port X are:
136
143
  // X / 10 + ((X % 10) * 3)
137
144
 
138
- // mode
145
+ // sysFds:
146
+ // Map a file descriptor from the /sys/class/gpio/gpioX/value file
147
+
148
+ static int sysFds [64] ;
149
+
150
+ // Mode
139
151
 
140
152
  static int gpioPinMode ;
141
153
 
@@ -267,6 +279,9 @@ void wiringPiGpioMode (int mode)
267
279
  /*
268
280
  * wiringPiSetup:
269
281
  * Must be called once at the start of your program execution.
282
+ *
283
+ * Default setup: Initialises the system into wiringPi Pin mode and uses the
284
+ * memory mapped hardware directly.
270
285
  *********************************************************************************
271
286
  */
272
287
 
@@ -386,6 +401,65 @@ int wiringPiSetup (void)
386
401
  }
387
402
 
388
403
 
404
+ /*
405
+ * wiringPiSetupGpio:
406
+ * Must be called once at the start of your program execution.
407
+ *
408
+ * GPIO setup: Initialises the system into GPIO Pin mode and uses the
409
+ * memory mapped hardware directly.
410
+ *********************************************************************************
411
+ */
412
+
413
+ int wiringPiSetupGpio (void)
414
+ {
415
+ int x = wiringPiSetup () ;
416
+
417
+ if (x != 0)
418
+ return x ;
419
+
420
+ wiringPiGpioMode (WPI_MODE_GPIO) ;
421
+ return 0 ;
422
+ }
423
+
424
+
425
+ /*
426
+ * wiringPiSetupSys:
427
+ * Must be called once at the start of your program execution.
428
+ *
429
+ * Initialisation (again), however this time we are using the /sys/class/gpio
430
+ * interface to the GPIO systems - slightly slower, but always usable as
431
+ * a non-root user, assuming the devices are already exported and setup correctly.
432
+ */
433
+
434
+ int wiringPiSetupSys (void)
435
+ {
436
+ int fd, pin ;
437
+ struct timeval tv ;
438
+ char fName [128] ;
439
+
440
+ // Set GPIO_SYS mode by default
441
+
442
+ wiringPiGpioMode (WPI_MODE_GPIO_SYS) ;
443
+
444
+ // Open and scan the directory, looking for exported GPIOs, and pre-open
445
+ // the 'value' part to speed things up for later
446
+
447
+ for (pin = 0 ; pin < 64 ; ++pin)
448
+ {
449
+ sysFds [pin] = -1 ;
450
+ sprintf (fName, "/sys/class/gpio/gpio%d/value", pin) ;
451
+ if ((fd = open (fName, O_RDWR)) == -1)
452
+ continue ;
453
+ sysFds [pin] = fd ;
454
+ }
455
+
456
+ gettimeofday (&tv, NULL) ;
457
+ epoch = (tv.tv_sec * 1000000 + tv.tv_usec) / 1000 ;
458
+
459
+ return 0 ;
460
+ }
461
+
462
+
389
463
  /*
390
464
  * pinMode:
391
465
  * Sets the mode of a pin to be input, output or PWM output
@@ -399,6 +473,10 @@ void pinMode (int pin, int mode)
399
473
  int gpioPin, fSel, shift ;
400
474
  int alt ;
401
475
 
476
+ // We can't change the mode in GPIO_SYS mode
477
+
478
+ if (gpioPinMode == WPI_MODE_GPIO_SYS)
479
+ return ;
402
480
 
403
481
  if (gpioPinMode == WPI_MODE_PINS)
404
482
  {
@@ -412,7 +490,6 @@ void pinMode (int pin, int mode)
412
490
  fSel = gpioToGPFSEL [gpioPin] ;
413
491
  shift = gpioToShift [gpioPin] ;
414
492
 
415
-
416
493
  /**/ if (mode == INPUT)
417
494
  *(gpio + fSel) = (*(gpio + fSel) & ~(7 << shift)) ; // Sets bits to zero = input
418
495
  else if (mode == OUTPUT)
@@ -480,10 +557,23 @@ void digitalWrite (int pin, int value)
480
557
  else
481
558
  gpioPin = pin ;
482
559
 
483
- if (value == HIGH)
484
- *(gpio + gpioToGPSET [gpioPin]) = 1 << gpioPin ;
560
+ if (gpioPinMode == WPI_MODE_GPIO_SYS)
561
+ {
562
+ if (sysFds [gpioPin] != -1)
563
+ {
564
+ if (value == LOW)
565
+ write (sysFds [gpioPin], "0\n", 2) ;
566
+ else
567
+ write (sysFds [gpioPin], "1\n", 2) ;
568
+ }
569
+ }
485
570
  else
486
- *(gpio + gpioToGPCLR [gpioPin]) = 1 << gpioPin ;
571
+ {
572
+ if (value == LOW)
573
+ *(gpio + gpioToGPCLR [gpioPin]) = 1 << gpioPin ;
574
+ else
575
+ *(gpio + gpioToGPSET [gpioPin]) = 1 << gpioPin ;
576
+ }
487
577
  }
488
578
 
489
579
 
@@ -497,6 +587,11 @@ void pwmWrite (int pin, int value)
497
587
  {
498
588
  int port, gpioPin ;
499
589
 
590
+ // We can't do this in GPIO_SYS mode
591
+
592
+ if (gpioPinMode == WPI_MODE_GPIO_SYS)
593
+ return ;
594
+
500
595
  if (gpioPinMode == WPI_MODE_PINS)
501
596
  {
502
597
  if ((pin < 0) || (pin >= NUM_PINS))
@@ -521,6 +616,7 @@ void pwmWrite (int pin, int value)
521
616
  int digitalRead (int pin)
522
617
  {
523
618
  int gpioPin ;
619
+ char c ;
524
620
 
525
621
  if (gpioPinMode == WPI_MODE_PINS)
526
622
  {
@@ -531,10 +627,24 @@ int digitalRead (int pin)
531
627
  else
532
628
  gpioPin = pin ;
533
629
 
534
- if ((*(gpio + gpioToGPLEV [gpioPin]) & (1 << gpioPin)) != 0)
535
- return HIGH ;
630
+ if (gpioPinMode == WPI_MODE_GPIO_SYS)
631
+ {
632
+ if (sysFds [gpioPin] == -1)
633
+ return 0 ;
634
+ else
635
+ {
636
+ lseek (sysFds [gpioPin], 0L, SEEK_SET) ;
637
+ read (sysFds [gpioPin], &c, 1) ;
638
+ return (c == '0') ? 0 : 1 ;
639
+ }
640
+ }
536
641
  else
537
- return LOW ;
642
+ {
643
+ if ((*(gpio + gpioToGPLEV [gpioPin]) & (1 << gpioPin)) != 0)
644
+ return HIGH ;
645
+ else
646
+ return LOW ;
647
+ }
538
648
  }
539
649
 
540
650
  /*
@@ -550,6 +660,11 @@ void pullUpDnControl (int pin, int pud)
550
660
  {
551
661
  int gpioPin ;
552
662
 
663
+ // We can't do this in GPIO_SYS mode
664
+
665
+ if (gpioPinMode == WPI_MODE_GPIO_SYS)
666
+ return ;
667
+
553
668
  if (gpioPinMode == WPI_MODE_PINS)
554
669
  {
555
670
  if ((pin < 0) || (pin >= NUM_PINS))
@@ -25,8 +25,9 @@
25
25
 
26
26
  #define NUM_PINS 17
27
27
 
28
- #define WPI_MODE_PINS 0
29
- #define WPI_MODE_GPIO 1
28
+ #define WPI_MODE_PINS 0
29
+ #define WPI_MODE_GPIO 1
30
+ #define WPI_MODE_GPIO_SYS 2
30
31
 
31
32
  #define INPUT 0
32
33
  #define OUTPUT 1
@@ -48,7 +49,11 @@ extern "C" {
48
49
  #endif
49
50
 
50
51
  extern int wiringPiSetup (void) ;
52
+ extern int wiringPiSetupSys (void) ;
53
+ extern int wiringPiSetupGpio (void) ;
54
+
51
55
  extern void wiringPiGpioMode (int mode) ;
56
+
52
57
  extern void pullUpDnControl (int pin, int pud) ;
53
58
  extern void pinMode (int pin, int mode) ;
54
59
  extern void digitalWrite (int pin, int value) ;
@@ -1841,7 +1841,7 @@ SWIG_ruby_failed(void)
1841
1841
  }
1842
1842
 
1843
1843
 
1844
- /*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1844
+ /*@SWIG:/usr/local/share/swig/2.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1845
1845
  SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1846
1846
  {
1847
1847
  VALUE obj = args[0];
@@ -1886,7 +1886,7 @@ SWIG_AsVal_int (VALUE obj, int *val)
1886
1886
  }
1887
1887
 
1888
1888
 
1889
- /*@SWIG:/usr/share/swig2.0/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1889
+ /*@SWIG:/usr/local/share/swig/2.0.7/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
1890
1890
  SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
1891
1891
  {
1892
1892
  VALUE obj = args[0];
@@ -1945,6 +1945,29 @@ SWIG_From_unsigned_SS_char (unsigned char value)
1945
1945
  }
1946
1946
 
1947
1947
 
1948
+ SWIGINTERN int
1949
+ SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
1950
+ {
1951
+ unsigned long v;
1952
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
1953
+ if (SWIG_IsOK(res)) {
1954
+ if ((v > UINT_MAX)) {
1955
+ return SWIG_OverflowError;
1956
+ } else {
1957
+ if (val) *val = (unsigned int)(v);
1958
+ }
1959
+ }
1960
+ return res;
1961
+ }
1962
+
1963
+
1964
+ SWIGINTERNINLINE VALUE
1965
+ SWIG_From_unsigned_SS_int (unsigned int value)
1966
+ {
1967
+ return SWIG_From_unsigned_SS_long (value);
1968
+ }
1969
+
1970
+
1948
1971
  SWIGINTERN swig_type_info*
1949
1972
  SWIG_pchar_descriptor(void)
1950
1973
  {
@@ -2019,6 +2042,38 @@ fail:
2019
2042
  }
2020
2043
 
2021
2044
 
2045
+ SWIGINTERN VALUE
2046
+ _wrap_wiringPiSetupSys(int argc, VALUE *argv, VALUE self) {
2047
+ int result;
2048
+ VALUE vresult = Qnil;
2049
+
2050
+ if ((argc < 0) || (argc > 0)) {
2051
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2052
+ }
2053
+ result = (int)wiringPiSetupSys();
2054
+ vresult = SWIG_From_int((int)(result));
2055
+ return vresult;
2056
+ fail:
2057
+ return Qnil;
2058
+ }
2059
+
2060
+
2061
+ SWIGINTERN VALUE
2062
+ _wrap_wiringPiSetupGpio(int argc, VALUE *argv, VALUE self) {
2063
+ int result;
2064
+ VALUE vresult = Qnil;
2065
+
2066
+ if ((argc < 0) || (argc > 0)) {
2067
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2068
+ }
2069
+ result = (int)wiringPiSetupGpio();
2070
+ vresult = SWIG_From_int((int)(result));
2071
+ return vresult;
2072
+ fail:
2073
+ return Qnil;
2074
+ }
2075
+
2076
+
2022
2077
  SWIGINTERN VALUE
2023
2078
  _wrap_wiringPiGpioMode(int argc, VALUE *argv, VALUE self) {
2024
2079
  int arg1 ;
@@ -2265,6 +2320,64 @@ fail:
2265
2320
  }
2266
2321
 
2267
2322
 
2323
+ SWIGINTERN VALUE
2324
+ _wrap_delay(int argc, VALUE *argv, VALUE self) {
2325
+ unsigned int arg1 ;
2326
+ unsigned int val1 ;
2327
+ int ecode1 = 0 ;
2328
+
2329
+ if ((argc < 1) || (argc > 1)) {
2330
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2331
+ }
2332
+ ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
2333
+ if (!SWIG_IsOK(ecode1)) {
2334
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","delay", 1, argv[0] ));
2335
+ }
2336
+ arg1 = (unsigned int)(val1);
2337
+ delay(arg1);
2338
+ return Qnil;
2339
+ fail:
2340
+ return Qnil;
2341
+ }
2342
+
2343
+
2344
+ SWIGINTERN VALUE
2345
+ _wrap_delayMicroseconds(int argc, VALUE *argv, VALUE self) {
2346
+ unsigned int arg1 ;
2347
+ unsigned int val1 ;
2348
+ int ecode1 = 0 ;
2349
+
2350
+ if ((argc < 1) || (argc > 1)) {
2351
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2352
+ }
2353
+ ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
2354
+ if (!SWIG_IsOK(ecode1)) {
2355
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","delayMicroseconds", 1, argv[0] ));
2356
+ }
2357
+ arg1 = (unsigned int)(val1);
2358
+ delayMicroseconds(arg1);
2359
+ return Qnil;
2360
+ fail:
2361
+ return Qnil;
2362
+ }
2363
+
2364
+
2365
+ SWIGINTERN VALUE
2366
+ _wrap_millis(int argc, VALUE *argv, VALUE self) {
2367
+ unsigned int result;
2368
+ VALUE vresult = Qnil;
2369
+
2370
+ if ((argc < 0) || (argc > 0)) {
2371
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2372
+ }
2373
+ result = (unsigned int)millis();
2374
+ vresult = SWIG_From_unsigned_SS_int((unsigned int)(result));
2375
+ return vresult;
2376
+ fail:
2377
+ return Qnil;
2378
+ }
2379
+
2380
+
2268
2381
  SWIGINTERN VALUE
2269
2382
  _wrap_serialOpen(int argc, VALUE *argv, VALUE self) {
2270
2383
  char *arg1 = (char *) 0 ;
@@ -2430,6 +2543,39 @@ fail:
2430
2543
  }
2431
2544
 
2432
2545
 
2546
+ SWIGINTERN VALUE
2547
+ _wrap_serialPrintf(int argc, VALUE *argv, VALUE self) {
2548
+ int arg1 ;
2549
+ char *arg2 = (char *) 0 ;
2550
+ void *arg3 = 0 ;
2551
+ int val1 ;
2552
+ int ecode1 = 0 ;
2553
+ int res2 ;
2554
+ char *buf2 = 0 ;
2555
+ int alloc2 = 0 ;
2556
+
2557
+ if (argc < 2) {
2558
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2559
+ }
2560
+ ecode1 = SWIG_AsVal_int(argv[0], &val1);
2561
+ if (!SWIG_IsOK(ecode1)) {
2562
+ SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "int","serialPrintf", 1, argv[0] ));
2563
+ }
2564
+ arg1 = (int)(val1);
2565
+ res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
2566
+ if (!SWIG_IsOK(res2)) {
2567
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","serialPrintf", 2, argv[1] ));
2568
+ }
2569
+ arg2 = (char *)(buf2);
2570
+ serialPrintf(arg1,arg2,arg3);
2571
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2572
+ return Qnil;
2573
+ fail:
2574
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2575
+ return Qnil;
2576
+ }
2577
+
2578
+
2433
2579
 
2434
2580
  /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2435
2581
 
@@ -2704,6 +2850,8 @@ SWIGEXPORT void Init_wiringpi(void) {
2704
2850
 
2705
2851
  SWIG_RubyInitializeTrackings();
2706
2852
  rb_define_module_function(mWiringpi, "wiringPiSetup", _wrap_wiringPiSetup, -1);
2853
+ rb_define_module_function(mWiringpi, "wiringPiSetupSys", _wrap_wiringPiSetupSys, -1);
2854
+ rb_define_module_function(mWiringpi, "wiringPiSetupGpio", _wrap_wiringPiSetupGpio, -1);
2707
2855
  rb_define_module_function(mWiringpi, "wiringPiGpioMode", _wrap_wiringPiGpioMode, -1);
2708
2856
  rb_define_module_function(mWiringpi, "pullUpDnControl", _wrap_pullUpDnControl, -1);
2709
2857
  rb_define_module_function(mWiringpi, "pinMode", _wrap_pinMode, -1);
@@ -2712,11 +2860,15 @@ SWIGEXPORT void Init_wiringpi(void) {
2712
2860
  rb_define_module_function(mWiringpi, "digitalRead", _wrap_digitalRead, -1);
2713
2861
  rb_define_module_function(mWiringpi, "shiftOut", _wrap_shiftOut, -1);
2714
2862
  rb_define_module_function(mWiringpi, "shiftIn", _wrap_shiftIn, -1);
2863
+ rb_define_module_function(mWiringpi, "delay", _wrap_delay, -1);
2864
+ rb_define_module_function(mWiringpi, "delayMicroseconds", _wrap_delayMicroseconds, -1);
2865
+ rb_define_module_function(mWiringpi, "millis", _wrap_millis, -1);
2715
2866
  rb_define_module_function(mWiringpi, "serialOpen", _wrap_serialOpen, -1);
2716
2867
  rb_define_module_function(mWiringpi, "serialClose", _wrap_serialClose, -1);
2717
2868
  rb_define_module_function(mWiringpi, "serialPutchar", _wrap_serialPutchar, -1);
2718
2869
  rb_define_module_function(mWiringpi, "serialPuts", _wrap_serialPuts, -1);
2719
2870
  rb_define_module_function(mWiringpi, "serialDataAvail", _wrap_serialDataAvail, -1);
2720
2871
  rb_define_module_function(mWiringpi, "serialGetchar", _wrap_serialGetchar, -1);
2872
+ rb_define_module_function(mWiringpi, "serialPrintf", _wrap_serialPrintf, -1);
2721
2873
  }
2722
2874
 
@@ -2,6 +2,7 @@ require 'wiringpi/wiringpi'
2
2
 
3
3
  WPI_MODE_PINS = 0 # Use sane pin numbering
4
4
  WPI_MODE_GPIO = 1 # Use Broadcom barmy GPIO pin numbering
5
+ WPI_MODE_SYS = 2 # Use /sys/class/gpio method
5
6
 
6
7
  # Constants for mode()
7
8
  INPUT = 0
@@ -103,13 +104,19 @@ module WiringPi
103
104
 
104
105
  def wiringPiSetup
105
106
 
106
- begin
107
- Wiringpi.wiringPiSetup
107
+ begin
108
+ if @mode == WPI_MODE_PINS
109
+ Wiringpi.wiringPiSetup
110
+ elsif @mode == WPI_MODE_GPIO
111
+ Wiringpi.wiringPiSetupGpio
112
+ elsif @mode == WPI_MODE_SYS
113
+ Wiringpi.wiringPiSetupSys
114
+ end
108
115
  rescue Exception=>e
109
116
  raise e
110
117
  end
111
118
 
112
- Wiringpi.wiringPiGpioMode( @mode )
119
+ #Wiringpi.wiringPiGpioMode( @mode )
113
120
  @@init = true
114
121
 
115
122
  end
@@ -170,13 +177,13 @@ and handing to Wiringpi.shiftOut, must contain only 1s or 0s
170
177
  raise ArgumentError, "invalid clock pin, available gpio pins: #{PINS}" unless checkPin(clockPin)
171
178
  raise ArgumentError, "invalid latch pin, available gpio pins: #{PINS}" unless checkPin(latchPin)
172
179
 
173
- WiringPi.write( latchPin, LOW )
180
+ Wiringpi.digitalWrite( latchPin, LOW )
174
181
 
175
182
  bits.each_slice(8) do |slice|
176
183
  Wiringpi.shiftOut(dataPin, clockPin, LSBFIRST, slice.reverse.join.to_i(2))
177
184
  end
178
185
 
179
- WiringPi.write( latchPin, HIGH )
186
+ Wiringpi.digitalWrite( latchPin, HIGH )
180
187
 
181
188
  end
182
189
 
@@ -184,17 +191,17 @@ and handing to Wiringpi.shiftOut, must contain only 1s or 0s
184
191
  shiftOut int dataPin, int clockPin, int latchPin, char
185
192
  Shift out a single 8-bit integer 0-255
186
193
  =end
187
- def shiftOut(dataPin, clockPin, latchPin, char)
194
+ def shiftOut(dataPin, clockPin, byteOrder, char)
188
195
 
189
- raise ArgumentError, "invalid data pin, available gpio pins: #{PINS}" unless checkPin(dataPin)
190
- raise ArgumentError, "invalid clock pin, available gpio pins: #{PINS}" unless checkPin(clockPin)
191
- raise ArgumentError, "invalid latch pin, available gpio pins: #{PINS}" unless checkPin(latchPin)
196
+ #raise ArgumentError, "invalid data pin, available gpio pins: #{PINS}" unless checkPin(dataPin)
197
+ #raise ArgumentError, "invalid clock pin, available gpio pins: #{PINS}" unless checkPin(clockPin)
198
+ #raise ArgumentError, "invalid latch pin, available gpio pins: #{PINS}" unless checkPin(latchPin)
192
199
 
193
- WiringPi.write( latchPin, LOW )
200
+ #Wiringpi.digitalWrite( latchPin, LOW )
194
201
 
195
- Wiringpi.shiftOut(dataPin, clockPin, LSBFIRST, char)
202
+ Wiringpi.shiftOut(dataPin, clockPin, byteOrder, char)
196
203
 
197
- WiringPi.write( latchPin, HIGH )
204
+ #Wiringpi.digitalWrite( latchPin, HIGH )
198
205
 
199
206
  end
200
207
 
@@ -230,4 +237,4 @@ Reads values of all pins and returns them as a hash
230
237
 
231
238
  end
232
239
 
233
- end
240
+ end
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.2
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: