#include "struct.h"
void (*ptr)(const char*);
void test(const char* p) {
Serial.print("Test: ");
Serial.println(p);
}
void textInput(const char* txt) {
Serial.print("textInput: ");
Serial.println(txt);
}
void func1(); // declare func
void func2(int n); // declare func
//void (*f)(); // declare pointer
void (*f)(void *); // declare pointer
void CallFunc(void(*func)(void *), void *param) {
func(param);
}
void func1() { Serial.println("func1"); }
void func2(int n) { Serial.print("func2: "); Serial.println(n); }
struct strct {
void *param;
void(*func)(void *);
void runFunc() {
func(param);
}
};
strct structo;
// ---------------------------------------
const char* getStr() {
const char* str = "HELLO";
return str;
}
void setup() {
Serial.begin(9600);
const char* myStr = getStr();
Serial.println(myStr);
ptr = test;
(*ptr)("Hello");
//while (1);
struct TreeNode *entry = &menuTree;
if (entry->children[0]) {
struct TreeNode *child = entry->children[0];
if (child->action != NULL) {
child->action("hello");
}
}
/*
// WORKS
structo.param = 42;
structo.func = func2;
//structo.runFunc();
structo.func(42);
*/
/*
f = func1;
(*f)();
void (*f2)(void *) = &func2;
*/
}
void loop() {
delay(1);
}