Skip to content

Commit 2c32f30

Browse files
committed
experiment ...
1 parent 04c40c5 commit 2c32f30

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

Diff for: src/Arduino_Threads.h

+21-6
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,28 @@ class Arduino_Threads
127127
void threadFunc();
128128
};
129129

130-
#define THD_ENTER(tabname) class ARDUINO_THREADS_CONCAT(tabname, Class) : public Arduino_Threads { \
131-
public: \
132-
ARDUINO_THREADS_CONCAT(tabname, Class)() { _tabname = ARDUINO_THREADS_TO_STRING(tabname); } \
133-
private: \
130+
#define THD_SETUP(ns) ns::setup()
131+
#define THD_LOOP(ns) ns::loop()
132+
133+
#define THD_ENTER(tabname) \
134+
namespace ARDUINO_THREADS_CONCAT(tabname,private)\
135+
{\
136+
void setup();\
137+
void loop();\
138+
}\
139+
class ARDUINO_THREADS_CONCAT(tabname, Class) : public Arduino_Threads\
140+
{\
141+
public:\
142+
ARDUINO_THREADS_CONCAT(tabname, Class)() { _tabname = ARDUINO_THREADS_TO_STRING(tabname); }\
143+
protected:\
144+
virtual void setup() override { THD_SETUP(ARDUINO_THREADS_CONCAT(tabname,private)); }\
145+
virtual void loop() override { THD_LOOP(ARDUINO_THREADS_CONCAT(tabname,private)); }\
146+
};\
147+
namespace ARDUINO_THREADS_CONCAT(tabname,private)\
148+
{
134149

135-
#define THD_DONE(tabname) \
136-
}; \
150+
#define THD_DONE(tabname)\
151+
};\
137152
ARDUINO_THREADS_CONCAT(tabname,Class) tabname;
138153

139154
#endif /* ARDUINO_THREADS_H_ */

0 commit comments

Comments
 (0)