simple_raspberrypi 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/simple_raspberrypi.rb +10 -13
- data.tar.gz.sig +0 -0
- metadata +3 -24
- metadata.gz.sig +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e9fcff2fd025e211eb5669400edfd1cdf3e9f6fd
         | 
| 4 | 
            +
              data.tar.gz: f427f3e0a03abc2c3da2b845a35838c92637a203
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9cb9087bdfcb433fefc6742e2bc5c163ad0e56a4bb5fe3218ecb8ece10c88e5f901050ea32a88b541a852435809d55ec48582877adcb91fcbc207e298d3d1be2
         | 
| 7 | 
            +
              data.tar.gz: 7c90ce6cd8d0bb6201004989bc93c25a2808be6488962c4c1f39ff3aac8d2e1e164d5fe62c63ed7bb73c68f97f1c56f1c2af44e72b34d1b5edff7794a4f7b72a
         | 
    
        checksums.yaml.gz.sig
    CHANGED
    
    | Binary file | 
    
        data/lib/simple_raspberrypi.rb
    CHANGED
    
    | @@ -3,10 +3,7 @@ | |
| 3 3 | 
             
            # file: simple_raspberrypi.rb
         | 
| 4 4 |  | 
| 5 5 | 
             
            # desc: This gem is similar to the rpi gem, with the only 
         | 
| 6 | 
            -
            #       difference being the class name and this gem  | 
| 7 | 
            -
            #       rpi_gpio instead of the pi_piper gem which depends upon wiringpi.
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            require 'rpi_gpio'
         | 
| 6 | 
            +
            #       difference being the class name and this gem has no dependencies.
         | 
| 10 7 |  | 
| 11 8 |  | 
| 12 9 | 
             
            HIGH = 1
         | 
| @@ -16,11 +13,12 @@ class SimpleRaspberryPi | |
| 16 13 |  | 
| 17 14 |  | 
| 18 15 | 
             
              class PinX
         | 
| 19 | 
            -
                include RPi
         | 
| 20 16 |  | 
| 21 17 | 
             
                def initialize(id)
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                   | 
| 18 | 
            +
             | 
| 19 | 
            +
                  File.write '/sys/class/gpio/export', id
         | 
| 20 | 
            +
                  File.write "/sys/class/gpio/gpio#{id}/direction", 'out'
         | 
| 21 | 
            +
             | 
| 24 22 | 
             
                  @id = id
         | 
| 25 23 |  | 
| 26 24 | 
             
                end
         | 
| @@ -73,7 +71,7 @@ class SimpleRaspberryPi | |
| 73 71 | 
             
                def set_pin(val)
         | 
| 74 72 |  | 
| 75 73 | 
             
                  state = @state
         | 
| 76 | 
            -
                   | 
| 74 | 
            +
                  File.write "/sys/class/gpio/gpio#{@id}/value", val
         | 
| 77 75 | 
             
                  @state = state
         | 
| 78 76 | 
             
                end
         | 
| 79 77 |  | 
| @@ -90,8 +88,6 @@ class SimpleRaspberryPi | |
| 90 88 | 
             
              end  
         | 
| 91 89 |  | 
| 92 90 | 
             
              def initialize(x=[])
         | 
| 93 | 
            -
             | 
| 94 | 
            -
                RPi::GPIO.set_numbering :bcm  
         | 
| 95 91 |  | 
| 96 92 | 
             
                a = case x
         | 
| 97 93 | 
             
                when Fixnum
         | 
| @@ -101,6 +97,8 @@ class SimpleRaspberryPi | |
| 101 97 | 
             
                when Array
         | 
| 102 98 | 
             
                  x
         | 
| 103 99 | 
             
                end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                unexport_all a
         | 
| 104 102 |  | 
| 105 103 |  | 
| 106 104 | 
             
                @pins = a.map {|pin| PinX.new pin.to_i }
         | 
| @@ -120,8 +118,7 @@ class SimpleRaspberryPi | |
| 120 118 | 
             
                  # to avoid "Device or resource busy @ fptr_finalize - /sys/class/gpio/export"
         | 
| 121 119 | 
             
                  # we unexport the pins we used
         | 
| 122 120 |  | 
| 123 | 
            -
                   | 
| 124 | 
            -
                  RPi::GPIO.reset
         | 
| 121 | 
            +
                  unexport_all a
         | 
| 125 122 | 
             
                end    
         | 
| 126 123 | 
             
              end
         | 
| 127 124 |  | 
| @@ -155,4 +152,4 @@ if __FILE__ == $0 then | |
| 155 152 | 
             
              # example
         | 
| 156 153 | 
             
              my_rpi = SimpleRaspberryPi.new %w(17 22 18 4 23 25 27) # <-- each pin connects to an LED
         | 
| 157 154 | 
             
              my_rpi.pins[ARGV.first.to_i].method(ARGV.last.to_sym).call
         | 
| 158 | 
            -
            end
         | 
| 155 | 
            +
            end
         | 
    
        data.tar.gz.sig
    CHANGED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: simple_raspberrypi
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Robertson
         | 
| @@ -32,27 +32,7 @@ cert_chain: | |
| 32 32 | 
             
              VCYD0S+Rz1/Ltw==
         | 
| 33 33 | 
             
              -----END CERTIFICATE-----
         | 
| 34 34 | 
             
            date: 2016-04-09 00:00:00.000000000 Z
         | 
| 35 | 
            -
            dependencies:
         | 
| 36 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 37 | 
            -
              name: rpi_gpio
         | 
| 38 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 39 | 
            -
                requirements:
         | 
| 40 | 
            -
                - - "~>"
         | 
| 41 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 42 | 
            -
                    version: '0.2'
         | 
| 43 | 
            -
                - - ">="
         | 
| 44 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            -
                    version: 0.2.0
         | 
| 46 | 
            -
              type: :runtime
         | 
| 47 | 
            -
              prerelease: false
         | 
| 48 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 49 | 
            -
                requirements:
         | 
| 50 | 
            -
                - - "~>"
         | 
| 51 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 52 | 
            -
                    version: '0.2'
         | 
| 53 | 
            -
                - - ">="
         | 
| 54 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 55 | 
            -
                    version: 0.2.0
         | 
| 35 | 
            +
            dependencies: []
         | 
| 56 36 | 
             
            description: 
         | 
| 57 37 | 
             
            email: james@r0bertson.co.uk
         | 
| 58 38 | 
             
            executables: []
         | 
| @@ -83,6 +63,5 @@ rubyforge_project: | |
| 83 63 | 
             
            rubygems_version: 2.4.8
         | 
| 84 64 | 
             
            signing_key: 
         | 
| 85 65 | 
             
            specification_version: 4
         | 
| 86 | 
            -
            summary: Has the same features as the rpi gem, but  | 
| 87 | 
            -
              the pi_piper gem.
         | 
| 66 | 
            +
            summary: Has the same features as the rpi gem, but does not require and gem dependencies.
         | 
| 88 67 | 
             
            test_files: []
         | 
    
        metadata.gz.sig
    CHANGED
    
    | Binary file |