diff --git a/Tutorials_Overview/IdleLoop/README.md b/Tutorials_Overview/IdleLoop/README.md deleted file mode 100644 index 7367402..0000000 --- a/Tutorials_Overview/IdleLoop/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# IdleLoop example # - -IdleLoop usage example for Mbed OS - -This is an example showing the purpose of IdleLoop thread that is scheduled when no other threads are ready to run. In this example, we have a regular thread that is scheduled to run every 5 seconds. Because no other thread is scheduled to run, IdleLoop runs and toggles the LED. diff --git a/Tutorials_Overview/IdleLoop/main.cpp b/Tutorials_Overview/IdleLoop/main.cpp deleted file mode 100644 index 1189147..0000000 --- a/Tutorials_Overview/IdleLoop/main.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "mbed.h" -#include "rtos_idle.h" - -// LED for main thread -DigitalOut led2(LED2); -// LED for idle thread -DigitalOut led1(LED1); -LowPowerTicker watchdogTicker; -Thread watchdogThread; -EventQueue watchdogQueue; - -void watchdogRefreshHandler() -{ - led2 = !led2; -}; - -void watchdogRefreshIsr() -{ - watchdogQueue.call(callback(&watchdogRefreshHandler)); -}; - -void new_idle_loop() -{ - // Executes when no other thread is running - led1 = !led1; -} - -int main() -{ - - watchdogThread.start(callback(&watchdogQueue, &EventQueue::dispatch_forever)); - watchdogTicker.attach(callback(&watchdogRefreshIsr), 5); - rtos_attach_idle_hook(&new_idle_loop); -}