Эх сурвалжийг харах

Initial working version of IDLE sleep on Teensy

Anatoli Arkhipenko 8 жил өмнө
parent
commit
23e8cfae0b

+ 3 - 15
src/TaskScheduler.h

@@ -168,9 +168,6 @@ extern "C" {
 #define _TASK_ESP8266_DLY_THRESHOLD 200L
 #endif  // ARDUINO_ARCH_ESP8266
 
-#ifdef  CORE_TEENSY 
-#include <Snooze.h>
-#endif
 #endif  // _TASK_SLEEP_ON_IDLE_RUN
 
 
@@ -526,14 +523,12 @@ Scheduler::Scheduler() {
     init();
 }
 
+/*
 Scheduler::~Scheduler() {
 #ifdef _TASK_SLEEP_ON_IDLE_RUN
-#ifdef CORE_TEENSY
-    delete config;
-	delete timer;
-#endif //CORE_TEENSY
 #endif // _TASK_SLEEP_ON_IDLE_RUN
 }
+*/
 
 /** Initializes all internal varaibles
  */
@@ -546,13 +541,6 @@ void Scheduler::init() {
 #endif  // _TASK_PRIORITY
 #ifdef _TASK_SLEEP_ON_IDLE_RUN
     allowSleep(true);
-	
-#ifdef CORE_TEENSY
-	timer = new SnoozeTimer;
-	config = new SnoozeBlock(*timer);
-	timer->setTimer(1);
-#endif //CORE_TEENSY
-	
 #endif  // _TASK_SLEEP_ON_IDLE_RUN
 }
 
@@ -814,7 +802,7 @@ bool Scheduler::execute() {
 #endif // ARDUINO_ARCH_AVR
 
 #ifdef CORE_TEENSY
-	Snooze.sleep(*config);
+    asm("wfi");
 #endif //CORE_TEENSY
 
 #ifdef ARDUINO_ARCH_ESP8266

+ 1 - 10
src/TaskSchedulerDeclarations.h

@@ -26,10 +26,6 @@
     #define _TASK_SCOPE  private
 #endif
 
-#ifdef CORE_TEENSY
-#include <Snooze.h>
-#endif //CORE_TEENSY
-
 #define TASK_IMMEDIATE          0
 #define TASK_FOREVER         (-1)
 #define TASK_ONCE               1
@@ -192,7 +188,7 @@ class Scheduler {
   friend class Task;
   public:
     Scheduler();
-	~Scheduler();
+//	~Scheduler();
     void init();
     void addTask(Task& aTask);
     void deleteTask(Task& aTask);
@@ -221,11 +217,6 @@ class Scheduler {
 #ifdef _TASK_SLEEP_ON_IDLE_RUN
     bool        iAllowSleep;                      // indication if putting avr to IDLE_SLEEP mode is allowed by the program at this time. 
 
-#ifdef CORE_TEENSY
-	SnoozeTimer *timer;
-	SnoozeBlock *config;
-#endif //CORE_TEENSY
-
 #endif  // _TASK_SLEEP_ON_IDLE_RUN
 #ifdef _TASK_PRIORITY
     Scheduler  *iHighPriority;                    // Pointer to a higher priority scheduler