jwhitehorn / pi_piper

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

Why is lib/pi_piper/driver.rb empty method definitions? #81

Open maraaaa opened 7 years ago

maraaaa commented 7 years ago

Hello,

I'm trying to understand how this code works, and I see in lib/pi_piper/pin.rb you call PiPiper.driver.pin_write - https://github.com/jwhitehorn/pi_piper/blob/develop/lib/pi_piper/pin.rb#L61

In lib/pi_piper.rb you seem to initialize PiPiper.driver as an instance of PiPiper::Driver https://github.com/jwhitehorn/pi_piper/blob/develop/lib/pi_piper.rb#L19-L32

What I don't understand, is why is lib/pi_piper/driver.rb full of empty method definitions? Where do you actually do the writing to filehandles?

In previous versions you actually wrote to /sys/class/gpio/gpio#{pin}/value - https://github.com/jwhitehorn/pi_piper/blob/master/lib/pi_piper/bcm2835.rb#L40

What am I missing here? How does this know to write to the correct location?

Thanks!

zsyed91 commented 7 years ago

Hi, we are about to release 3.0 where we pulled out the driver so it can be driver-agnostic.

We will default the driver to the sysfs driver but currently we have 2 implementations ready.

  1. https://github.com/PiPiper/sysfs/blob/master/lib/pi_piper/sysfs/sysfs.rb
  2. https://github.com/PiPiper/bcm2835/blob/dev/lib/bcm2835/driver.rb

We have empty method definitions because we wanted to have an interface in which we can spin out other drivers while making sure that they follow what we have defined.

I am hoping to release 3.0 for sure this coming weekend. Some things came up and prevented a release for last weekend. I have tested the code on a couple of components and everything seems stable so far. I am fairly confident that we can release 3.0 at this point.

I am sure @elmatou can agree.

mrambossek commented 5 years ago

hello good people. any updates on this?

elmatou commented 5 years ago

The gel is on hold/abandoned, by the maintainers. Everything should be easy to get working. I plan to spin out the code and start a new project based on release 3.0 but I lack time for now. If you are willing to work on this, I may be able to help you.