esl / erlang_ale

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

Mega-patch to pull in various updates from forks #19

Closed fhunleth closed 9 years ago

fhunleth commented 9 years ago

[Apologies for the mega-patch. I think that this will be worthwhile change, but it's probably worth tagging the project to avoid disrupting anyone using it by a pretty major refactoring. Also, the diff view on GitHub is a little scary due to the deletions. It looks more recognizable as Erlang/ALE when you look at my repository.]

Many of the updates come from changes to the C code to fix race conditions, simplify building (including cross-compiling), and add functionality. The changes had been collected in the Elixir/ALE project, and given that both projects had similar issues, it seemed better to hold the fixes here. Given the nature of the changes, it was difficult to commit incrementally and still have working builds. Hence this mega-patch.

This code has been manually tested on an Erlang Embedded Demo Board.

The following is a summary of changes:

  1. Updated documentation with schematics showing use
  2. Fixed race conditions with GPIO (no more multiple threads in C)
  3. Fix interrupt support on Raspberry Pi 2. No more infinite interrupts.
  4. Eliminate dependencies. This made is possible to build in some situations. It also should help people use it out of the box.
  5. Use binaries on I2C. This makes dealing with I2C a lot more pleasant. While I2C theoretically supports 10-bit bytes, very few chips use this in practice.
  6. Simplify port code and interface to Erlang.
  7. Remove PWM interface. This was Raspberry Pi specific and not maintained.
  8. Make one multi-call binary. This reduces memory usage and simplifies the build system.
  9. Only support Linux. The previous code had an abstraction layer in anticipation of porting to RTOS's. That never happened, and the API had many Linux assumptions in it anyway.
    1. Support "atomic" write, read transactions on I2C. This is a very common usage scenario.
    2. Require client code to register names for ALE processes if it wants them. The previous code sometimes registered with gproc and sometimes locally. The user decides now.
    3. Remove most tests. They had limited coverage and complicated the GPIO code. The gpio_counter example still exists and has been updated.
    4. Use rebar3 to build.
    5. Fix gpio interrupt filter so that transients on the GPIO don't send an unexpected notification.

Signed-off-by: Frank Hunleth fhunleth@troodon-software.com

fhunleth commented 9 years ago

Fixed the README.md comments. I also noticed that the git clone line was pointing to my repo, so I changed that to the esl/erlang_ale repo.