Hello there,
i want to create a small Library which is used for my projects which require reoccurent tasks, like connecting to a WiFi, registering to a MQTT Broker etc. Therefore i wanted to create a Library which wraps around Arduino and provides some basic tasks. Additional code should be embedded via special functions. An example code could look like this:
#include “TinyOS.h”
void os_setup() {
// Additional setup code
}
void os_loop() {
// Additional loop code
}
Like Arduino uses the main() function and calls own setup() and loop() functions i want my “OS Lib” to call os_setup() and os_loop() functions.
My lib is included to an example project via lib_deps=TinyOS and lib_extra_dirs=C:\path\to\lib
The TinyOS.h contains following code:
#ifndef TinyOS_h
#defineTinyOS_h
void os_setup(void);
void os_loop(void);
#endif
The code TinyOS.cpp contains following code:
#include "TinyOS.h"
void setup() {
// TBD...
os_setup();
}
void loop() {
// TBD...
os_loop();
}
How can I add the dependency to Arduino in my lib?
Is my approach correct or am I totally wrong?
Any kind of help is appreciated