esl / erlang_ale

Erlang Actor Library for Embedded -- An embedded framework from Erlang Solutions
Apache License 2.0
207 stars 65 forks source link

Ale handler #25

Closed ethrbh closed 9 years ago

ethrbh commented 9 years ago

hello,

I have made an handler for Erlang/ALE features, such as GPIO, I2C and SPI. This handler can start, monitor and re-start the GPIO, I2C or SPI drivers.

Example has been added and its README has updated.

thanks, /Robi

fhunleth commented 9 years ago

Wouldn't using a supervisor be an easier route for starting, monitoring, and restarting the GPIO, I2C and SPI processes?

ethrbh commented 9 years ago

hello,

Yes, that also would be good. If I like to be honest, I was in the "very" middle of the implementation of handler without this "monitor feature", and when I thought that this feature would be good to have, I was lazy to start supervisor implementation, thus I just started to use pure monitor / demonitor. I do not see any problem to keep this way for the long term run, but I also open to move to supervisor.

thanks for your help, /Robi

knewter commented 9 years ago

Since the other open PR adds a supervisor, if I merged that one could this be rolled into that supervisor instead?

ethrbh commented 9 years ago

hello Josh,

I think everything is possible to do, but before say anything 100% sure, I would like to see that other open PR what you are mentioned. Is it possible to check it out?

thanks for your help, /Robi

knewter commented 9 years ago

Sure,

I was referring to your other PR, where you add an empty supervisor that supervises nothing - https://github.com/ethrbh/erlang_ale/commit/f9c20d70782d7356ad3403882f2fb0f6e35f7857#diff-4598e848e236341d38a61fe84fe6b911R11

If the supervisor started those processes and monitored them, then you wouldn't need to check for their existence, or start them, or monitor them on your own - right? The system would just make sure they were running.

I might be completely missing something, but it seemed like fighting OTP a bit. Alternatively, perhaps there's another layer further down from the root supervisor that ought to start those processes. It's also entirely possible I'm just missing something because I've not yet re-acclimated after being out of the country last week. @fhunleth ?

ethrbh commented 9 years ago

hello Josh,

Oh, now I see what you mean. But that supervisor is "just part" erlang.mk support. It was generated automatically by erlang.mk when I added erlang.mk. I did not started use that supervisor because my solution was done already. But now I have sime time, and I can try move the existing supervisor logic into erlang_ale_sup.erl instead.

I will update you about my progress.

thanks for your help, /Robi

knewter commented 9 years ago

Awesome, thanks :)

ethrbh commented 9 years ago

You are welcome :-)

/Robi

ethrbh commented 9 years ago

hello Josh and Frank,

I'm done with my planned changes and I have issued a new pull request for this. Please take a look at this https://github.com/esl/erlang_ale/pull/27

I also think that this current pull request (#25) can be closed, because this is "out dated".

thanks for your help, /Robi

knewter commented 9 years ago

closing as superseded by #27