add waitForEvent() as macro for __WFE(). Enable Idle Hook and call wfe instruction

This commit is contained in:
hathach committed 2017-04-08 16:59:56 +07:00
1 parent 887d0354a0
commit 291a28b507
4 files changed
+13 -6

No files matched your search

+1 -1
View File
@@ -113,7 +113,7 @@
#define configENABLE_BACKWARD_COMPATIBILITY 1
/* Hook function related definitions. */
#define configUSE_IDLE_HOOK 0
#define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0
#define configCHECK_FOR_STACK_OVERFLOW 1
#define configUSE_MALLOC_FAILED_HOOK 1
+10
View File
@@ -82,3 +82,13 @@ bool SchedulerRTOS::startLoop(taskfunc_t task, const char* name, uint32_t stack_
return pdPASS == xTaskCreate( _redirect_task, name, stack_size, (void*) task, TASK_PRIO_NORMAL, &handle);
}
extern "C"
{
void vApplicationIdleHook( void )
{
waitForEvent();
}
}
+1 -4
View File
@@ -24,10 +24,7 @@ extern "C" {
extern void init(void);
static inline void sleep(void)
{
__WFE();
}
#define waitForEvent() __WFE()
extern void enterSerialDfu(void);
extern void enterOTADfu(void);
@@ -107,7 +107,7 @@ void loop()
// Equavilent to __WFE (Wait For Event) instruction.
// It is a hint to allow CPU to enter low-power state until an event occured
sleep();
waitForEvent();
}
void connect_callback(void)