change rtos_idle_hook behavior
- if rtos_idle_callback is not defined, go to low-power when Idle. Otherwise user have to call waitForEvent() manually.
This commit is contained in:
1 parent
e45f489767
commit
730ee7e1d6
2 files changed
+11
-9
No files matched your search
@@ -111,6 +111,7 @@ uint32_t setLoopStacksize(void);
|
||||
#define portModeRegister(port) ( &(NRF_GPIO->DIRSET) )
|
||||
#define digitalPinHasPWM(P) ( true )
|
||||
|
||||
void rtos_idle_callback(void) ATTR_WEAK;
|
||||
/*
|
||||
* digitalPinToTimer(..) is AVR-specific and is not defined for nRF52
|
||||
* architecture. If you need to check if a pin supports PWM you must
|
||||
|
||||
+10
-9
@@ -82,9 +82,6 @@ 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);
|
||||
}
|
||||
|
||||
void rtos_idle_callback(void) ATTR_WEAK;
|
||||
void rtos_idle_callback(void) {}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
@@ -92,11 +89,15 @@ void vApplicationIdleHook( void )
|
||||
{
|
||||
// Internal background task
|
||||
|
||||
// Weak symbol do nothing if is not implementation
|
||||
rtos_idle_callback();
|
||||
|
||||
// All done. Instruct CPU to enter low-power state until an event/interrupt occurred
|
||||
waitForEvent();
|
||||
// User callback is not defined. Go to low-power mode
|
||||
if ( rtos_idle_callback )
|
||||
{
|
||||
rtos_idle_callback();
|
||||
}else
|
||||
{
|
||||
// instruct CPU to enter low-power state until an event/interrupt occurred
|
||||
waitForEvent();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // extern C
|
||||
Reference in new issue
Block a user