From b80c5a89bf54798809d39d9a692654c03516e5e2 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 31 Aug 2017 18:15:38 +0700 Subject: [PATCH] test systemOff without freeRTOS --- cores/nRF5/main.cpp | 6 +++++- .../examples/Hardware/blinky/blinky.ino | 16 ++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/cores/nRF5/main.cpp b/cores/nRF5/main.cpp index 56c53046..d66ccbbe 100644 --- a/cores/nRF5/main.cpp +++ b/cores/nRF5/main.cpp @@ -70,7 +70,7 @@ static void loop_task(void* arg) #endif // To compatible with most code where loop is not rtos-aware - taskYIELD(); // vTaskDelay(1); +// taskYIELD(); // vTaskDelay(1); } } @@ -91,6 +91,9 @@ int main( void ) SEGGER_SYSVIEW_Conf(); #endif +#if 1 + loop_task(NULL); +#else // Create a task for loop() TaskHandle_t _loopHandle; xTaskCreate( loop_task, "loop", _loopStacksize, NULL, TASK_PRIO_NORMAL, &_loopHandle); @@ -99,6 +102,7 @@ int main( void ) vTaskStartScheduler(); NVIC_SystemReset(); +#endif return 0; } diff --git a/libraries/Bluefruit52Lib/examples/Hardware/blinky/blinky.ino b/libraries/Bluefruit52Lib/examples/Hardware/blinky/blinky.ino index 35a06c2e..bf105401 100644 --- a/libraries/Bluefruit52Lib/examples/Hardware/blinky/blinky.ino +++ b/libraries/Bluefruit52Lib/examples/Hardware/blinky/blinky.ino @@ -20,13 +20,17 @@ // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. - pinMode(LED_BUILTIN, OUTPUT); } - + // the loop function runs over and over again forever void loop() { - digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) - delay(1000); // wait for a second - digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW - delay(1000); // wait for a second +#if 0 + for (int i = 0; i < 2; i++) + { + digitalToggle(LED_BLUE); // turn the LED on (HIGH is the voltage level) + delay(1000); // wait for a second + } +#endif + + systemOff(A0, HIGH); }