jwhitehorn / pi_piper

Event driven Raspberry Pi GPIO programming in Ruby
BSD 2-Clause "Simplified" License
694 stars 71 forks source link

RPi 3+ 64bits #91

Open nofxx opened 6 years ago

nofxx commented 6 years ago

Looks like there's GPIO support now on 64bits bcm2835, albeit I could not find any lib examples/docs so far (wiringpi or other libs).

BCM2835.so compiles fine in AARCH64 and looks like low level GPIO works.
After recompiling the static in piper's folder I ended up in:

/usr/lib/ruby/gems/2.5.0/gems/pi_piper-2.0.0/lib/pi_piper/bcm2835.rb:65:in `write': Invalid argument @ fptr_finalize_flush - /sys/class/gpio/export

Sorry can't be of much help now, dunno much about the low level stuff here.

NetForces commented 6 years ago

Getting the same:

root@raspberrypi:~# ruby test.rb
Press the switch to get started
/var/lib/gems/2.3.0/gems/pi_piper-2.0.0/lib/pi_piper/bcm2835.rb:65:in `write': Device or resource busy @ fptr_finalize - /sys/class/gpio/export (Errno::EBUSY)
    from /var/lib/gems/2.3.0/gems/pi_piper-2.0.0/lib/pi_piper/bcm2835.rb:65:in `export'
    from /var/lib/gems/2.3.0/gems/pi_piper-2.0.0/lib/pi_piper/bcm2835.rb:34:in `pin_input'
    from /var/lib/gems/2.3.0/gems/pi_piper-2.0.0/lib/pi_piper/pin.rb:58:in `initialize'
    from /var/lib/gems/2.3.0/gems/pi_piper-2.0.0/lib/pi_piper.rb:15:in `new'
    from /var/lib/gems/2.3.0/gems/pi_piper-2.0.0/lib/pi_piper.rb:15:in `block in watch'

Very simple test code (one of the examples):

require 'pi_piper'

puts "Press the switch to get started"

PiPiper.watch :pin => 26, :invert => true do |pin|
  puts "Pin changed from #{pin.last_value} to #{pin.value}"
end

PiPiper.wait