Skip to content

Commit e84fd54

Browse files
committed
added suspendLoop for low power
1 parent 8493fd6 commit e84fd54

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
### Core
66

77
- Make FreeRTOS run in tickless mode
8-
- Added systemOff() to enter hibernate mode
8+
- Added systemOff() to enter System Off mode
9+
- Added suspendLoop() to disable loop() task to further save power
910
- Correct waitForEvent() function with SoftDevice enabled and disabled.
1011
- Added RotaryEncoder support for both Hardware and Software Encoder.
1112
- Ada Callback task is started along with loop task, used as worker thread to defer interrupt callback.

cores/nRF5/Arduino.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ void yield( void ) ;
3535
void setup( void ) ;
3636
void loop( void ) ;
3737

38+
void suspendLoop(void);
3839
uint32_t setLoopStacksize(void);
3940

4041
#include "WVariant.h"

cores/nRF5/main.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ void Bluefruit_printInfo() {}
3232
#include "SEGGER_SYSVIEW.h"
3333
#endif
3434

35+
static TaskHandle_t _loopHandle;
36+
3537

3638
// Weak empty variant initialization function.
3739
// May be redefined by variant files.
@@ -92,7 +94,6 @@ int main( void )
9294
#endif
9395

9496
// Create a task for loop()
95-
TaskHandle_t _loopHandle;
9697
xTaskCreate( loop_task, "loop", _loopStacksize, NULL, TASK_PRIO_LOW, &_loopHandle);
9798

9899
// Initialize callback task
@@ -105,3 +106,8 @@ int main( void )
105106

106107
return 0;
107108
}
109+
110+
void suspendLoop(void)
111+
{
112+
vTaskSuspend(_loopHandle);
113+
}

0 commit comments

Comments
 (0)