klajo / wpi

An Erlang NIF for the WiringPi library for the Raspberry Pi
GNU Lesser General Public License v3.0
30 stars 10 forks source link

Automatically downloads/installs wiringPi library #7

Open mpoli opened 11 years ago

mpoli commented 11 years ago

Hello again!

I have changed the rebar.config file to automatically download and install the required wiringPi library, and created a Makefile that will do that and make rebar itself, just to make it easier to use, given that rebar's error when a dependency is not found is somewhat cryptic.

Please review if it interests you to merge that into your code.

Thanks for the great work on this library! And I hope I can contribute a bit.

Marco

klajo commented 11 years ago

Thanks. I'll check it out and get back to you in a couple of days.

/Klas

klajo commented 11 years ago

Hi,

Thanks again for your contributions. I have a number of comments.

First, it would be nice if contributions are done to a side branch, since that makes discussions around the code (and any following changes) easier to do and the commit history cleaner. Right now the pull request above looks a bit funny, since it's got 3 commits (including a merge commit) where the new contribution is the last. I've updated the README.md with a that information (it didn't exist before, sorry about that).

If you feel like it it should be possible to rewind your master branch, to fit mine, and then cherry-pick the new rebar.config additions to a side-branch. Something like this (you can of course do this on a new clone of your own repo if you want to play around a bit; clone your repo not mine):

this should show your github clone of wpi

git remote show origin

create a branch at your current master, to make sure we don't lose it

git branch mpoli-master

rewind master to the commit before your first wiring pi lib change

git reset --hard 4c42c1ddf0eb2947dd74847164ae0fe0df28cbeb

add my repo as "upstream" (yours will be "origin")

git remote add upstream git@github.com:klajo/wpi.git

pull the latest changes into master (your master is now the same as mine)

git pull upstream master

check with gitk if you like

gitk --all &

create and go to a new "feature branch" for your new change

git checkout -b get-and-compile-deps

cherry-pick your rebar.config change (from your "old" mpoli-master) into the side-branch

git cherry-pick 9390e79b2ec7d7accfce440dc2b0fcc1a50670ab

Now you could push master and that side-branch to your github repo and notify me. I hope. :-)

Secondly, your change will mean that the wiringPi libraries are installed (using sudo) every time we type make, right? I think an optional target for those libs would be nicer since it doesn't force a particular set of libraries on a user. Maybe someone uses another version (perhaps locally modified).

Thanks, Klas

mpoli commented 11 years ago

I am sorry I am taking so long to reply, I am generating the release for the project and that is consuming all my time.

By the way, I had to revert to the Oct 2012 version of the code and remove the LCD-related parts. Your recent support for the new wiringPi library just rendered my installation of the library unfunctional (returns ok, but doesn't change pin mode, etc.).

I will elaborate and try to figure out what happened as soon as I get some spare time.

Thanks for the great work.

klajo commented 11 years ago

Hi,

Did you call one of the setup functions? I added those in commits d29a866 and 3fc91d2 and they are mandatory. The first commit explains why I decided to break backwards compatibility. I've successfully blinked a led using my latest code and WiringPi v2.

Pin = 7, wpi:setup(), % or setup_gpio/0 or setup_sys/0 wpi:pin_mode(Pin, output), wpi:digital_write(Pin, 1),

Would be good to figure out what's going on.

Regards, Klas