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

Add support for bare-metal AVR #43

Closed
wants to merge 1 commit into from
Closed

Add support for bare-metal AVR #43

wants to merge 1 commit into from

Conversation

kevinpt
Copy link

@kevinpt kevinpt commented Dec 30, 2017

I've added some changes to support using TaskScheduler on bare-metal AVR without the Arduino support libraries. Additional minor work is needed to do the same for ESP8266 and ESP32.

@arkhipenko
Copy link
Owner

Thanks. Will look into this after the holidays.

@arkhipenko
Copy link
Owner

arkhipenko commented Jan 9, 2018

Hi,
I am a little concerned about this part:

#  if !(defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32))
#    error Missing ARDUINO_ARCH_* definition.
#  endif

Will it nor break other platforms, like teensy or other non-AVR ones which supply their own Arduino.h?
I have never implemented this for bare-bones, so help is appreciated.

@arkhipenko
Copy link
Owner

I am thinking further: wouldn't a simpler and safer (from the compatibility perspective) way be to include a small local Arduino.h include with your changes for the bare-metal implementations? This way there is no need to change the library at all.
(I am just trying to avoid platform-specific limitations as much as I can).
What do you think?

@arkhipenko
Copy link
Owner

arkhipenko commented Jan 10, 2018

Upon further thinking I went with a explicit brute force approach:

#ifdef _TASK_BARE_METAL
	extern unsigned long micros(void);
	extern unsigned long millis(void);
	extern void yield(void);
	extern void delay(unsigned long);
#endif

All sketches seem to compile fine.
Will push this into the testing branch. Could you please test once it is there?

Thanks

@arkhipenko
Copy link
Owner

Updated in the testing branch. Please test.

@arkhipenko
Copy link
Owner

arkhipenko commented Jan 12, 2018

As a matter of fact I don't think TaskScheduler uses yield() or delay(). I can just go with those:

#ifdef _TASK_BARE_METAL
	extern unsigned long micros(void);
	extern unsigned long millis(void);
#endif

@arkhipenko
Copy link
Owner

Will give you a little more time to test if you wish, otherwise will close this request.

@kevinpt
Copy link
Author

kevinpt commented Jan 16, 2018

I believe the plain ARDUINO define is also used if you want a platform independent check for the Arduino environment.

@arkhipenko
Copy link
Owner

Pushed v2.6.0 into the "testing" branch with bare metal fwd definitions. Could you please test?
https://github.com/arkhipenko/TaskScheduler/tree/testing

@arkhipenko arkhipenko closed this Jan 31, 2018
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

Successfully merging this pull request may close these issues.

2 participants