Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving logic code into libraries #70

Open
pastcompute opened this issue Apr 1, 2015 · 4 comments
Open

Moving logic code into libraries #70

pastcompute opened this issue Apr 1, 2015 · 4 comments

Comments

@pastcompute
Copy link
Contributor

Hi, this is just an option for discussion, it depends on which way you want to take this.

I have a project I'm basing on frankenstein and one of the things I will be doing is writing a program that schedules a timer task to poll a bunch of sensors. To this end it included copying the bulk of the code out of ds18b20.c to another file and making the entry point extern so I could call it from my code.

Longer term for most of the commands like ds18b20 that do similar things, they could be improved by making them expose an internal API (usually, just a single extern function) that the static method that parses the argv would call, that could then be called by other code to use the same functionality.

The tcp_send command is another similar example

If you like I can submit that change for ds18b20 and dht22 as a proof of concept

If this is not suitable I'm not fussed, I'll just keep a local fork of relevant logic code in my project

@susisstrolch
Copy link

Great idea - I was also thinking about...
Having the lib and the cmd stub makes it much easier to develop own projects!

@nekromant
Copy link
Owner

Yep, this is something I wanted to do, prior to moving these to antares itself.
However, before that I still planned to:

  1. Implement delaylib wrapper for esp8266 (cross-mcu delays, AFAIR dht22 uses delays for timing. Using antares' delaylib will instantly make it work on all other architectures)
  2. Implement a generic i2c subsystem for antares and rebase all i2c sensors on-top of it.
    ...
    PROFIT

@darkbyte-ru
Copy link
Contributor

I can split i2c modules to two parts: library for antares and command for frankenstein, but I do not know how to do it better way.

Tons of i2c_* files seems terrible to me. I try to combine all i2c libs in one file and leave separated cmd files, and it's look much more terrible :D

Maybe try combine all cmd_i2c in one file (with ifdef's for every driver) and leave separated i2c drivers?

@nekromant
Copy link
Owner

@darkbyte-ru Don't do it just yet, give me a little time to make an proper i2c subsystem for antares.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants